pw_tokenizer: Use datetime.isoformat

The isoformat functions are quite a bit faster than their format string
equivalents, and the `parse_csv` function is quite performance-sensitive
as this loop is run once for every token in a token database. This
change noticeably improved the performance of one downstream consumer.

N.B.: Token databases which represented dates using months and days
that were not padded two two digits will no longer be successfully
loaded. It doesn't seem like any such databases should have been
generated before using the old format string approach, but the previous
format-string based loading seems to have supported reading these types
of entries.

Bug: b/269511233
Change-Id: I01e6ef7a944d38190cddad90cf49d841efedbd68
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/129451
Pigweed-Auto-Submit: Taylor Cramer <cramertj@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
3 files changed
tree: 1e5c0424e540c7395e64834b57ffbfdcbd578e54
  1. .allstar/
  2. .vscode/
  3. build_overrides/
  4. docker/
  5. docs/
  6. pw_allocator/
  7. pw_analog/
  8. pw_android_toolchain/
  9. pw_arduino_build/
  10. pw_assert/
  11. pw_assert_basic/
  12. pw_assert_log/
  13. pw_assert_tokenized/
  14. pw_assert_zephyr/
  15. pw_async/
  16. pw_base64/
  17. pw_bloat/
  18. pw_blob_store/
  19. pw_bluetooth/
  20. pw_bluetooth_hci/
  21. pw_bluetooth_profiles/
  22. pw_boot/
  23. pw_boot_cortex_m/
  24. pw_build/
  25. pw_build_info/
  26. pw_build_mcuxpresso/
  27. pw_bytes/
  28. pw_checksum/
  29. pw_chrono/
  30. pw_chrono_embos/
  31. pw_chrono_freertos/
  32. pw_chrono_stl/
  33. pw_chrono_threadx/
  34. pw_chrono_zephyr/
  35. pw_cli/
  36. pw_compilation_testing/
  37. pw_console/
  38. pw_containers/
  39. pw_cpu_exception/
  40. pw_cpu_exception_cortex_m/
  41. pw_crypto/
  42. pw_digital_io/
  43. pw_docgen/
  44. pw_doctor/
  45. pw_env_setup/
  46. pw_file/
  47. pw_function/
  48. pw_fuzzer/
  49. pw_hdlc/
  50. pw_hex_dump/
  51. pw_i2c/
  52. pw_i2c_mcuxpresso/
  53. pw_ide/
  54. pw_interrupt/
  55. pw_interrupt_cortex_m/
  56. pw_interrupt_zephyr/
  57. pw_intrusive_ptr/
  58. pw_kvs/
  59. pw_libc/
  60. pw_log/
  61. pw_log_android/
  62. pw_log_basic/
  63. pw_log_null/
  64. pw_log_rpc/
  65. pw_log_string/
  66. pw_log_tokenized/
  67. pw_log_zephyr/
  68. pw_malloc/
  69. pw_malloc_freelist/
  70. pw_metric/
  71. pw_minimal_cpp_stdlib/
  72. pw_module/
  73. pw_multisink/
  74. pw_package/
  75. pw_perf_test/
  76. pw_persistent_ram/
  77. pw_polyfill/
  78. pw_preprocessor/
  79. pw_presubmit/
  80. pw_protobuf/
  81. pw_protobuf_compiler/
  82. pw_random/
  83. pw_result/
  84. pw_ring_buffer/
  85. pw_router/
  86. pw_rpc/
  87. pw_rust/
  88. pw_snapshot/
  89. pw_software_update/
  90. pw_span/
  91. pw_spi/
  92. pw_status/
  93. pw_stm32cube_build/
  94. pw_stream/
  95. pw_string/
  96. pw_symbolizer/
  97. pw_sync/
  98. pw_sync_baremetal/
  99. pw_sync_embos/
  100. pw_sync_freertos/
  101. pw_sync_stl/
  102. pw_sync_threadx/
  103. pw_sync_zephyr/
  104. pw_sys_io/
  105. pw_sys_io_arduino/
  106. pw_sys_io_baremetal_lm3s6965evb/
  107. pw_sys_io_baremetal_stm32f429/
  108. pw_sys_io_emcraft_sf2/
  109. pw_sys_io_mcuxpresso/
  110. pw_sys_io_pico/
  111. pw_sys_io_stdio/
  112. pw_sys_io_stm32cube/
  113. pw_sys_io_zephyr/
  114. pw_system/
  115. pw_target_runner/
  116. pw_thread/
  117. pw_thread_embos/
  118. pw_thread_freertos/
  119. pw_thread_stl/
  120. pw_thread_threadx/
  121. pw_tls_client/
  122. pw_tls_client_boringssl/
  123. pw_tls_client_mbedtls/
  124. pw_tokenizer/
  125. pw_tool/
  126. pw_toolchain/
  127. pw_trace/
  128. pw_trace_tokenized/
  129. pw_transfer/
  130. pw_unit_test/
  131. pw_varint/
  132. pw_watch/
  133. pw_web/
  134. pw_work_queue/
  135. seed/
  136. targets/
  137. third_party/
  138. ts/
  139. zephyr/
  140. .bazelignore
  141. .bazelrc
  142. .black.toml
  143. .clang-format
  144. .clang-tidy
  145. .eslintrc.json
  146. .git-blame-ignore-revs
  147. .gitattributes
  148. .gitignore
  149. .gn
  150. .mypy.ini
  151. .prettierrc.js
  152. .pw_ide.yaml
  153. .pylintrc
  154. activate.bat
  155. Android.bp
  156. AUTHORS
  157. bootstrap.bat
  158. bootstrap.sh
  159. BUILD.bazel
  160. BUILD.gn
  161. BUILDCONFIG.gn
  162. CMakeLists.txt
  163. jest.config.ts
  164. Kconfig.zephyr
  165. LICENSE
  166. modules.gni
  167. OWNERS
  168. package-lock.json
  169. package.json
  170. PIGWEED_MODULES
  171. PW_PLUGINS
  172. README.md
  173. rollup.config.js
  174. tsconfig.json
  175. WORKSPACE
README.md

Pigweed

Pigweed is an open source collection of embedded-targeted libraries–or as we like to call them, modules. These modules are building blocks and infrastructure that enable faster and more reliable development on small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics STM32L452 or the Nordic nRF52832.

For more information please see our website: https://pigweed.dev/.

Links