Optimize static method calls

Open
#701 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Refactor
Clarity
Needs clarification
Activity status
Stale
Tech stack
clojure

Research direction

Reproduce the benchmark using sci/eval-string with the Math.sin static call, then compare the generated function f with the direct foo definition. Investigate the interpreter path involved in static method calls; done means the benchmarked call no longer has the large performance gap shown in the issue.

Written by the indexing model from the issue text.

Description

user=> (def f (sci/eval-string "(fn [] (Math/sin 3.14))" {:classes {'Math Math}}))
#'user/f
user=>
user=> (defn foo [] (Math/sin 3.14))
#'user/foo
user=> (time (dotimes [i 1000000] (f)))
"Elapsed time: 2171.718646 msecs"
nil
user=> (time (dotimes [i 1000000] (foo)))
"Elapsed time: 18.466058 msecs"
nil
Dominant language
Clojure
Stars
1.4k
Forks
109
Avg merge
1m
Merged PRs (30d)
26

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from babashka/sci

All issues in babashka/sci

Similar issues

More Clojure issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.