Comments (11)
Is this still applicable? If so whereabouts does it calculate the length?
from asmttpd.
Ah yeah I think so.
Basically any function in string.asm that calls get_string_length at the beginning can probably be done away with if the length is passed as a parameter. I'm pretty sure it's still possible to do it this way, and would speed it up a bit.
from asmttpd.
Is there something we can use to test the performance increase / benefit?
from asmttpd.
Could do some math and calculate how many instructions you would save given an average string length or something...but the performance increase would be minimal, just trying to save some useless cycles.
from asmttpd.
Did some ab testing:
asmttpd
Document Length: 100996 bytes
Concurrency Level: 10
Time taken for tests: 0.013 seconds
Complete requests: 100
Failed requests: 0
Total transferred: 10110700 bytes
HTML transferred: 10099600 bytes
Requests per second: 7738.74 [#/sec] (mean)
Time per request: 1.292 [ms] (mean)
Time per request: 0.129 [ms] (mean, across all concurrent requests)
Transfer rate: 764102.34 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.3 0 1
Processing: 0 1 0.6 1 3
Waiting: 0 0 0.4 0 2
Total: 0 1 0.8 1 4
Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 1
80% 1
90% 3
95% 3
98% 4
99% 4
100% 4 (longest request)
nginx
Document Length: 100996 bytes
Concurrency Level: 10
Time taken for tests: 0.038 seconds
Complete requests: 100
Failed requests: 0
Total transferred: 10123400 bytes
HTML transferred: 10099600 bytes
Requests per second: 2605.18 [#/sec] (mean)
Time per request: 3.839 [ms] (mean)
Time per request: 0.384 [ms] (mean, across all concurrent requests)
Transfer rate: 257551.98 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.3 0 1
Processing: 1 3 1.5 3 9
Waiting: 1 3 1.3 3 8
Total: 1 4 1.5 4 9
Percentage of the requests served within a certain time (ms)
50% 4
66% 4
75% 5
80% 5
90% 6
95% 6
98% 8
99% 9
100% 9 (longest request)
But got disappointed after testing the same website in the browser. I saw firefox load asmttpd in 17 seconds vs nginx with 5 seconds.
I think we need some really awesome tricks to make it win.
from asmttpd.
Thanks for those stats - very interesting!
from asmttpd.
Interesting! I think it would need to use asynchronous i/o (epoll) to compete with things like nginx. I have an old issue [ #9 ] for it, but it's a ton of work.
from asmttpd.
I am very slowly working on this ;)
from asmttpd.
awesome you work on it anyway, I thought maybe we can use some other asm multi-tasking example. But did not find any.
from asmttpd.
The only way I can figure out to improve the concat function is to add two new concat functions, one for when you have a dest length already (removes need to use get_string_length at beginning), the other for when you have the src length (removing need to calculate the string length obviously). In httpd.asm we would make use of the server_header_len, content_length_len etc.
Each new function would only use get_string_length once instead of twice compared to the regular concat. I might be missing something really obvious here so please tell me if I am!
The method I described above would save 1 call to get_string_length in the add_content_type_header, 3-4 on average in each create_httpXXX_response.
Thoughts @nemasu?
from asmttpd.
@triforce Yeah, I believe that's what I had in mind, string_concat doesn't need to calculate the length of the string if we pass the length as a parameter.
Might even be able to get rid of the last get_string_length in the create_httpxxx_repsonse functions too if we're keeping a running total.
from asmttpd.
Related Issues (20)
- Segmentation fault when running asmhttpd HOT 19
- Program cannot be restarted right away after exiting if clients have connected. HOT 5
- Directory Listing HOT 2
- Make code commenting consistent HOT 2
- Byte-wise comparison of HEAD, GET, etc. HOT 1
- Take a part in the web framework competition
- can we put another commandline argument to specify port HOT 2
- can performance kill nginx? HOT 4
- Please add Documentation HOT 3
- Support SVG? HOT 1
- Cannot access file with multiple extension HOT 2
- Support https? HOT 4
- Support HTTP/2 HOT 2
- Default document for sub directories? HOT 3
- I compiled It, get segmentation fault and cant curl it. HOT 3
- was this project abandoned ? HOT 4
- Incorrect response when sending http request in telnet mode
- Missing memory fences in mutexes HOT 2
- PhP support? HOT 1
- is it possible to run it on cortex-A7? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asmttpd.