Tensegritics / Tensegritics/ClojureDart

Peephole optimization of `seq` calls

Open
#169 0 comments 1 reaction 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

It's idiomatic clojure to test emptiness with seq, because most of the time you are going to iterate with the returned value. So nil/sequence is more useful than false/true.
However there are still cases where seq is purely used in a boolean or existential context.

Proposal: when the compiler encounters a call to seq in a boolean or existential context, it should replace the call by another protocol call with fast-path (no alloc) emptiness checking.

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

Start by locating the compiler implementation for seq calls and the handling of boolean or existential contexts. Determine how protocol calls provide fast-path emptiness checking; done means those contexts avoid the seq allocation while ordinary seq usage remains unchanged, with compiler tests covering both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure, dart
Domain
compilers, performance
Issue type
Feature
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.