Skip to content

Performance

Every port is benchmarked on the same eight operations and the same 64 dates, defined once in the hub’s spec/BENCHMARK.md. Each port also measures every other Bikram Sambat library it could find in its language, on the same machine and the same dates.

In all seven languages, every port is faster than all 33 other libraries on both conversions. None of those libraries gives the same answer as the hub’s data on all 64 dates; each report lists where they differ.

BS to AD (B1), time per call. “Next fastest” is the fastest other library in that language.

LanguageNepDateNext fastestIts timeMeasured
Rust benchmark report2.9 nsnepdate-cli61 ns4
C++ benchmark report7.1 nsnepdate-cli33 ns3
Go benchmark report6.2 nsgo-nepali173 ns4
Swift benchmark report21 nsNepali-Date-Picker-SPM922 ns2
Kotlin benchmark report21 nsadbs403 ns3
TypeScript benchmark report31 nsnepali-datetime380 ns9
Python benchmark report724 nsbikram-sambat1.24 µs8

“Measured” counts the other libraries timed in that language. Each language’s report, linked from its name, has AD to BS (B2) too, every library’s row, which dates each one disagrees on, and why.

Time per call for B1 to B8. Lower is better. B8 builds a whole month grid with tithi and holidays, 29 to 32 days.

  • B1 BS to AD
  • B2 AD to BS
  • B3 Add 1000 days
  • B4 Add 13 months
  • B5 Long Nepali date with weekday
  • B6 Strict parse
  • B7 Patro info for a day
  • B8 Patro month grid
LanguageB1B2B3B4B5B6B7B8
Rust2.9 ns3.1 ns3.2 ns2.6 ns16 ns18 ns3.5 ns299 ns
C++7.1 ns8.9 ns7.5 ns5.6 ns28 ns12 ns13 ns517 ns
Go6.2 ns5.0 ns4.7 ns4.1 ns31 ns35 ns12 ns398 ns
Swift21 ns20 ns14 ns14 ns391 ns53 ns40 ns1.53 µs
Kotlin21 ns12 ns15 ns13 ns192 ns39 ns4.5 ns135 ns
TypeScript31 ns27 ns51 ns56 ns175 ns66 ns5.6 ns517 ns
Python724 ns822 ns662 ns598 ns527 ns1.32 µs128 ns21.6 µs
C# NepDate13 ns19 ns18 ns19 ns153 ns22 ns48 ns3.13 µs

C# NepDate 2.0.7 on .NET 10 is the reference (its report). The conversions, arithmetic and patro lookups allocate nothing in Rust, C++, Go and Swift.

  • Compare within a row of the first table, not across languages. Each language was measured on its own runtime, and Swift on GitHub’s macOS runner (Apple M1), not the laptop the others used (Intel Core i5-12500H).
  • Some runs were not on a quiet machine. Each report records the CPU load during its run; the stable release repeats them on an idle machine, pinned to one core, as the spec asks.
  • Speed is not the reason to pick a date library; correct dates are. Every port is checked against the same 20,360 golden rows and 7,176 month boundaries first (Same answer everywhere), and the benchmarks run only after that.

The method, the 64 dates and the rules for timing are in spec/BENCHMARK.md.