From dd4bfd028556e5717f8d793050597f8e217ec5ea Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Sat, 18 Mar 2023 15:56:43 +0100 Subject: [PATCH] Fix #71: reduce native image size by avoiding runtime resolve --- CHANGELOG.md | 4 ++++ src/data_readers.cljc | 3 ++- src/flatland/ordered/map.clj | 9 +++++---- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fe58a8..22c1b3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +* Solve native image size problem by removing runtime `resolve` [#71](https://github.com/clj-commons/ordered/issues/71) + ## 1.15.10 - 2021-10-09 ### Added diff --git a/src/data_readers.cljc b/src/data_readers.cljc index 4343648..cf52ffb 100644 --- a/src/data_readers.cljc +++ b/src/data_readers.cljc @@ -1,2 +1,3 @@ {ordered/set flatland.ordered.set/into-ordered-set - ordered/map flatland.ordered.map/ordered-map-reader} + ordered/map #?(:clj flatland.ordered.map/ordered-map-reader-clj + :cljs flatland.ordered.map/ordered-map-reader-cljs)} diff --git a/src/flatland/ordered/map.clj b/src/flatland/ordered/map.clj index 636e3a0..cd15ded 100644 --- a/src/flatland/ordered/map.clj +++ b/src/flatland/ordered/map.clj @@ -207,7 +207,8 @@ assoc'ed for the first time. Supports transient." (.write w "#ordered/map ") (print-method (seq o) w)) -(defn ordered-map-reader [coll] - (if (some-> (resolve 'cljs.env/*compiler*) deref) - `(ordered-map ~(vec coll)) - (ordered-map coll))) +(defn ordered-map-reader-clj [coll] + (ordered-map coll)) + +(defn ordered-map-reader-cljs [coll] + `(ordered-map ~(vec coll)))