Optimize code gen for empty queue

Description

If you have #queue [] in your code, the code generated is

when it could, for the empty vector case generate

See https://github.com/clojure/clojurescript/blob/f289ffee2270567f7976d45012a0a52c38eb6488/src/main/clojure/cljs/tagged_literals.cljc#L21

Environment

None

Activity

Show:
Colin Kahn
September 19, 2018, 11:12 PM

Hi Mike,

I updated the attached patch.

Those tests don't actually get run when you do 'lein test', looks like Travis does a build and runs them using jsc. I replicated locally, not sure if there are commands to make that easier.

Mike Fikes
September 19, 2018, 11:21 PM

Thanks. I'll take a look at the revised patch. These tests are run via script/test. More info at https://clojurescript.org/community/running-tests

Mike Fikes
September 19, 2018, 11:45 PM

With the patch #queue [] is free.

Benchmarking: (simple-benchmark [f (fn [] #queue [])] (f) 1e8)

Before:

After:

Mike Fikes
September 20, 2018, 12:33 AM

CLJS-2916.patch of 19/Sep/18 6:12 PM LGTM.

It passes all tests, including Canary tests. Perf looks good given the previous comment.

Mike Fikes
May 12, 2019, 2:30 AM

CLJS-2916.patch added to Patch Tender

Assignee

David Nolen

Reporter

Mike Fikes

Labels

Approval

None

Patch

Code and Test

Priority

Minor
Configure