How to improve response speed in a website, where a picture is drawn in real time at backend, using...
up vote
0
down vote
favorite
I hope to improve response speed as much as possible, and I test the time my drawing function, which spends 2.9~3.2 seconds.
Any tips to improve the speed are appreciated, from algorithm, program, website design...
The during time between 'user click draw button' and 'show picture in browser' is too long, using python and django, how can I reduce the time? Thanks in advance.
load 1.999396
angle2plane 3.0000000000196536e-05
getPoint 7.000000000090267e-06
getGrid 0.003222000000000058
D2MapD3 0.584085
getValue 0.032258999999999816
show 0.35327399999999987
total 2.982803
beg=time.clock()
ds=loadArray(filepath, (110,110,187))
end=time.clock()
print("load", str(end-beg))
ds=np.clip(ds, 0, 1)
print("alpha, beta, gamma:", alpha, beta, gamma)
beg=time.clock()
plane=angle2plane(alpha, beta, gamma, dis)
end=time.clock()
print("angle2plane", str(end-beg))
beg=time.clock()
A, B, C=getPoint(plane)
end=time.clock()
print("getPoint", str(end-beg))
beg=time.clock()
grid=getGrid(width, height)
end=time.clock()
print("getGrid", str(end-beg))
rowgrid=len(grid)
colgrid=len(grid[0])
beg=time.clock()
mpmatrix=D2MapD3(A, B, C, grid)
end=time.clock()
beg=time.clock()
values=getValue(mpmatrix, ds, width, height)
end=time.clock()
print("getValue", str(end-beg))
values=values.reshape(rowgrid, colgrid)
beg=time.clock()
plt.imshow(values)
plt.savefig("test.png")
end=time.clock()
print("show", str(end-beg))
python django draw
add a comment |
up vote
0
down vote
favorite
I hope to improve response speed as much as possible, and I test the time my drawing function, which spends 2.9~3.2 seconds.
Any tips to improve the speed are appreciated, from algorithm, program, website design...
The during time between 'user click draw button' and 'show picture in browser' is too long, using python and django, how can I reduce the time? Thanks in advance.
load 1.999396
angle2plane 3.0000000000196536e-05
getPoint 7.000000000090267e-06
getGrid 0.003222000000000058
D2MapD3 0.584085
getValue 0.032258999999999816
show 0.35327399999999987
total 2.982803
beg=time.clock()
ds=loadArray(filepath, (110,110,187))
end=time.clock()
print("load", str(end-beg))
ds=np.clip(ds, 0, 1)
print("alpha, beta, gamma:", alpha, beta, gamma)
beg=time.clock()
plane=angle2plane(alpha, beta, gamma, dis)
end=time.clock()
print("angle2plane", str(end-beg))
beg=time.clock()
A, B, C=getPoint(plane)
end=time.clock()
print("getPoint", str(end-beg))
beg=time.clock()
grid=getGrid(width, height)
end=time.clock()
print("getGrid", str(end-beg))
rowgrid=len(grid)
colgrid=len(grid[0])
beg=time.clock()
mpmatrix=D2MapD3(A, B, C, grid)
end=time.clock()
beg=time.clock()
values=getValue(mpmatrix, ds, width, height)
end=time.clock()
print("getValue", str(end-beg))
values=values.reshape(rowgrid, colgrid)
beg=time.clock()
plt.imshow(values)
plt.savefig("test.png")
end=time.clock()
print("show", str(end-beg))
python django draw
apart from D2MapD3, the other long functions are loading and saving. What do you use to load and save (what storage?)
– dirkgroten
2 days ago
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I hope to improve response speed as much as possible, and I test the time my drawing function, which spends 2.9~3.2 seconds.
Any tips to improve the speed are appreciated, from algorithm, program, website design...
The during time between 'user click draw button' and 'show picture in browser' is too long, using python and django, how can I reduce the time? Thanks in advance.
load 1.999396
angle2plane 3.0000000000196536e-05
getPoint 7.000000000090267e-06
getGrid 0.003222000000000058
D2MapD3 0.584085
getValue 0.032258999999999816
show 0.35327399999999987
total 2.982803
beg=time.clock()
ds=loadArray(filepath, (110,110,187))
end=time.clock()
print("load", str(end-beg))
ds=np.clip(ds, 0, 1)
print("alpha, beta, gamma:", alpha, beta, gamma)
beg=time.clock()
plane=angle2plane(alpha, beta, gamma, dis)
end=time.clock()
print("angle2plane", str(end-beg))
beg=time.clock()
A, B, C=getPoint(plane)
end=time.clock()
print("getPoint", str(end-beg))
beg=time.clock()
grid=getGrid(width, height)
end=time.clock()
print("getGrid", str(end-beg))
rowgrid=len(grid)
colgrid=len(grid[0])
beg=time.clock()
mpmatrix=D2MapD3(A, B, C, grid)
end=time.clock()
beg=time.clock()
values=getValue(mpmatrix, ds, width, height)
end=time.clock()
print("getValue", str(end-beg))
values=values.reshape(rowgrid, colgrid)
beg=time.clock()
plt.imshow(values)
plt.savefig("test.png")
end=time.clock()
print("show", str(end-beg))
python django draw
I hope to improve response speed as much as possible, and I test the time my drawing function, which spends 2.9~3.2 seconds.
Any tips to improve the speed are appreciated, from algorithm, program, website design...
The during time between 'user click draw button' and 'show picture in browser' is too long, using python and django, how can I reduce the time? Thanks in advance.
load 1.999396
angle2plane 3.0000000000196536e-05
getPoint 7.000000000090267e-06
getGrid 0.003222000000000058
D2MapD3 0.584085
getValue 0.032258999999999816
show 0.35327399999999987
total 2.982803
beg=time.clock()
ds=loadArray(filepath, (110,110,187))
end=time.clock()
print("load", str(end-beg))
ds=np.clip(ds, 0, 1)
print("alpha, beta, gamma:", alpha, beta, gamma)
beg=time.clock()
plane=angle2plane(alpha, beta, gamma, dis)
end=time.clock()
print("angle2plane", str(end-beg))
beg=time.clock()
A, B, C=getPoint(plane)
end=time.clock()
print("getPoint", str(end-beg))
beg=time.clock()
grid=getGrid(width, height)
end=time.clock()
print("getGrid", str(end-beg))
rowgrid=len(grid)
colgrid=len(grid[0])
beg=time.clock()
mpmatrix=D2MapD3(A, B, C, grid)
end=time.clock()
beg=time.clock()
values=getValue(mpmatrix, ds, width, height)
end=time.clock()
print("getValue", str(end-beg))
values=values.reshape(rowgrid, colgrid)
beg=time.clock()
plt.imshow(values)
plt.savefig("test.png")
end=time.clock()
print("show", str(end-beg))
python django draw
python django draw
asked 2 days ago
Jason
1
1
apart from D2MapD3, the other long functions are loading and saving. What do you use to load and save (what storage?)
– dirkgroten
2 days ago
add a comment |
apart from D2MapD3, the other long functions are loading and saving. What do you use to load and save (what storage?)
– dirkgroten
2 days ago
apart from D2MapD3, the other long functions are loading and saving. What do you use to load and save (what storage?)
– dirkgroten
2 days ago
apart from D2MapD3, the other long functions are loading and saving. What do you use to load and save (what storage?)
– dirkgroten
2 days ago
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
If it is a long running task,
you can try,
Using Celery with WebSockets
You can initiate a celery worker (refer here) to do the long running job and return the
results via websocket (django channels)
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
If it is a long running task,
you can try,
Using Celery with WebSockets
You can initiate a celery worker (refer here) to do the long running job and return the
results via websocket (django channels)
add a comment |
up vote
0
down vote
If it is a long running task,
you can try,
Using Celery with WebSockets
You can initiate a celery worker (refer here) to do the long running job and return the
results via websocket (django channels)
add a comment |
up vote
0
down vote
up vote
0
down vote
If it is a long running task,
you can try,
Using Celery with WebSockets
You can initiate a celery worker (refer here) to do the long running job and return the
results via websocket (django channels)
If it is a long running task,
you can try,
Using Celery with WebSockets
You can initiate a celery worker (refer here) to do the long running job and return the
results via websocket (django channels)
answered 2 days ago
Rejo Chandran
15013
15013
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53372922%2fhow-to-improve-response-speed-in-a-website-where-a-picture-is-drawn-in-real-tim%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
apart from D2MapD3, the other long functions are loading and saving. What do you use to load and save (what storage?)
– dirkgroten
2 days ago