summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.benchmark.md67
1 files changed, 67 insertions, 0 deletions
diff --git a/README.benchmark.md b/README.benchmark.md
new file mode 100644
index 0000000..808828d
--- /dev/null
+++ b/README.benchmark.md
@@ -0,0 +1,67 @@
+# Benchmark improvement progress
+
+## The initial benchmark timing based on v1.0-home-cooked-binary
+
+~~~~
+===== Execution time benchmark ======
+ 7.5 uS empty function
+ 10983.6 uS toBits(4000000)
+ 332.0 uS toNum
+ 336.2 uS freq2regestersValues
+ 96886.3 uS copySettings
+ 37.2 uS pad2NumBitsInPlace
+ 8796.9 uS bitSlice
+229184.0 uS FreqToSettings
+~~~~
+
+## Skipping settings clone in FreqToSettings
+
+Skipping the setting cloning via copySettings in FreqToSettings
+shaved about 100 uS out of initial 230 uS. It is ok
+to affect global workplace for settings since it is used
+everywhere anyway.
+
+~~~~
+===== Execution time benchmark ======
+ 7.5 uS empty function
+ 2785.8 uS empty table creation
+ 4153.9 uS table expand by 1 element
+ 5536.3 uS table expand by 2 element
+ 146.1 uS bit.rshift(4000000,1)
+ 10686.6 uS toBits(4000000)
+ 331.9 uS toNum
+ 333.4 uS freq2regestersValues
+ 94721.6 uS copySettings
+ 37.1 uS pad2NumBitsInPlace
+ 8567.5 uS bitSlice
+123669.0 uS FreqToSettings <-- changed
+~~~~
+
+
+## toBits improvement with bitwise operation failed
+
+Attempt to use bitmask and bitshifts instead of calculating
+reminder of division by 2 was unsuccessful. It increased
+execution time from 10mS to about 15mS. I am guessing
+that calling a function is longer then do division.
+Binary representation table creation and expansion still
+takes most of the time.
+
+## Skipping table binary representation and working with bits directly
+
+I abandoned a cleaner bits in tables approach, and use binary representation
+of masks and appropriate bits from calculated settings. The code is much
+harder to read but speed up of about 40 times totally worse it.
+
+~~~~
+> dofile("bench_lmx2487.lua")
+===== Execution time benchmark ======
+ 8.2 uS empty function
+ 2534.5 uS empty table creation
+ 3768.0 uS table expand by 1 element
+ 5032.4 uS table expand by 2 element
+ 130.8 uS bit.rshift(4000000,1)
+ 336.0 uS freq2regestersValues
+ 2840.7 uS FreqToSettings <-- changed
+ 5047.9 uS setFreq
+~~~~