Posts

Showing posts with the label project

SPO 600 Project - Stage 3

In this post, I will discuss my findings during Stage 3 of the project. For my previous stages, click here and here . Before I start, I think I should mention how to performance improved in percentage. And there's the result: [GeoffWu@aarchie tester]$ ./tester Run #1 original version took 33339704 nanoseconds modified version took 33237179 nanoseconds hash match: y difference between two versions: 102525 nanoseconds percentage difference: 0.307516 Run #2 original version took 33302201 nanoseconds modified version took 33231595 nanoseconds hash match: y difference between two versions: 70606 nanoseconds percentage difference: 0.212016 Run #3 original version took 33366103 nanoseconds modified version took 33270939 nanoseconds hash match: y difference between two versions: 95164 nanoseconds percentage difference: 0.285212 Run #4 original version took 33349119 nanoseconds modified version took 33346432 nanoseconds hash match: y difference between two version...

SPO 600 Project - Stage 2

In this post, I will discuss my findings during Stage 2 of the project. For more details, click here . Before I should talk about how I optimized the Murmurhash2 algorithm, I would like to answer a question that I forgot to add on my stage 1 post - where is that algorithm is used ? After doing some research, I found out that Tengine, just like nginx, uses Murmurhash2 in the ngx_http_split_clients_module , which is often used for A/B Testing . Alright then, let's talk about how I optimized the algorithm. First of all, I think I should mention the optimization strategies I eliminated: In-line assembler : Given Tengine is meant to support a variety of platforms and CPU architectures, I honesty don't think it is a good option to use it - unless Jack Ma would give me a job afterwards :) Altered build options : At first I considered this option, since it is the easiest one, and planning to change its compile options to -O3/-Ofast, but after checking the cc (which listed all ...

SPO 600 Project - Stage 1

For the SPO600 course, I need to complete a project of identifying a CPU-intensive function/method - let's say a checksum or hash algorithm - that is implemented in a language that compiles to machine code (e.g. C, C++, or Assembler) in an open-source project, improving its performance, then get that optimization accepted by the upstream. For more information, click here . Find an open source package For this project, I chose Tengine , a fork of the web server nginx  developed by Taobao . When I'm reading its source code in Github, I noticed that it also uses the MurmurHash , just like nginx. Since MurmurHash itself is a simple hash function, it would be difficult to improve it (I still remembered my professor once said an easy program is the most difficult one to optimize), I decided to accept the challenge, because why not? Benchmark the performance on AArch64 As the function is very simple, testing its performance is much simpler than I imagine: I just extract the ...