~/talk

Performance Pitfalls: Tales From a Python/OCaml Codebase

Talkat FUN OCaml 2025 · 2025-09-15..09-16· [python]
name:Emma Jin
links:none on file
slides:none on file

Semgrep combines an OCaml matching engine with a Python frontend and experiences three concrete performance failures: segfaulting stack overflows due to ulimit misconfiguration, huge startup overhead from invoking the OCaml binary dozens to hundreds of times (example: 100 OCaml calls turning a 2‑hour timeout into a 20‑minute run), and runaway memory from a 200MB targets file being copied across forks. Fixes include rewriting Python in OCaml, compressing rule indices, and moving to shared memory parallelism, which eliminates repeated startup and huge copy‑on‑write overheads.

AI-written summary · about

  1. 0:00Introduction and SEM grep
  2. 1:55Introducing OCaml to Python
  3. 3:18Stack overflow in OCaml
  4. 3:59Startup time overhead
  5. 7:31Solving startup time issues
  6. 9:18Memory usage problems
  7. 14:14Solving memory consumption
  8. 15:39Takeaways and lessons learned
  9. 18:07Q&A: Profiling end-to-end
  10. 20:59Q&A: Pressure for performance
  11. 23:02Q&A: Static analysis details
  12. 25:32Q&A: Fearless refactoring
  13. 27:21Q&A: CI scanning setup
  14. 28:49Q&A: Profiling challenges
  15. 29:32Q&A: Python to OCaml porting
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.