Tensegritics / Tensegritics/ClojureDart

Cross platform bit twiddling without the price

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

Nobody has claimed this yet.

enhancement
Dominant language
Clojure
Stars
1.6k
Forks
119
PR merge metrics
No merged PRs in 30d

Description

All our bit twiddling ops are written with great care to work both in native and JS. However it means that native platforms are using suboptimal expressions.

Solution 1:

Use conditional readers and have :cljd/js for branches specific to JS.
Pro: easy enough, integrates well with the clojure model
Cons: have to pass specific flag when compiling to web (and flutter sometimes default to web without us knowing)

Solution 2:

Have a special form and emit each branch of this form in a distinct lib (js or not). Use dart conditional imports to load the right one.
However most defns concerned by this issue have inlines and thus call sites would expand differently.

Solution 2.1:

Get rid of clojure inlines for these defns and use the "vm:prefer-inline" pragma (see https://github.com/dart-lang/sdk/issues/51977) to ask the Dart compiler to perform the inline

Solution 2.2:

Emit all nses as two libs (one js, one not). Details have to be figured out to see if an extra pass is required.

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

No source files or tests are named. Start by comparing the proposed conditional readers, :cljd/js branches, Dart conditional imports, and vm:prefer-inline approach, then determine how inline call sites and Flutter web compilation are affected. Done means native platforms use platform-appropriate bit operations without sacrificing JavaScript behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure, dart, flutter
Domain
compilers, mobile-dev, performance
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.