clojure-dev

Issues: https://clojure.atlassian.net/browse/CLJ | Guide: https://insideclojure.org/2015/05/01/contributing-clojure/
ikitommi 2020-03-03T08:22:17.108900Z

As ring is heading towards using namespaced keys in request & response maps (https://github.com/ring-clojure/ring/issues/393), is there a plan to support namespaces keys with records?

ikitommi 2020-03-03T08:23:39.110Z

I guess the lookups for unqualified & qualified keys from maps should have about the same performance?

ikitommi 2020-03-03T08:32:01.111300Z

a quick test for a field lookup for a ring-request map (14 keys) using: 1. qualfied key 24ns 2. unqualified key 20ns 3. record with unqualified key 4ns

dominicm 2020-03-07T22:45:45.131Z

Ran this test with a structmap for my own comparison. Structmap with key: (:foo/bar x) 24ns Structmap with accessor: (bar x) 11.65ns Record: (:bar x) 15.83ns

dominicm 2020-03-07T22:46:00.131200Z

Ran 999999 times in a dotimes block to compare.

ikitommi 2020-03-03T08:33:37.112200Z

if not record, maybe some new map-like type which would enable fast lookups with known qualified keys?

alexmiller 2020-03-03T13:46:19.113900Z

given how much things get added to request maps, I don't think records are necessarily a good choice anyways - changing a record means instantiating a new record

alexmiller 2020-03-03T13:46:56.114500Z

there are many ways request maps are used - focusing only on key lookup performance is missing other parts of the picture

alexmiller 2020-03-03T13:49:26.115300Z

it seems weird, but you may actually want to look at struct-maps

alexmiller 2020-03-03T13:51:04.115800Z

although I'm not sure struct-maps support ns'ed keys well either, I don't know if I've ever used them

dominicm 2020-03-07T22:40:47.130800Z

The bug starts in lift-ns. It creates an empty of the struct, which still includes the key as nil, ofc. And also includes the ns-removed version of the key. Simple answers are to convert structs to hashmap before printing, or to have lift-ns not use empty but instead an empty hashmap.

seancorfield 2020-03-07T23:09:17.131400Z

Interesting. I don't remember what tests I ran but I know I didn't get anything like the results I wanted so I came away thinking you couldn't use qualified keys at all in structs... Clearly, I didn't test extensively 🙂

alexmiller 2020-03-07T23:16:13.132300Z

That is actually already logged as it affects sorted maps

alexmiller 2020-03-07T23:36:22.133Z

I’ve spent some time looking at it and it’s annoying

alexmiller 2020-03-03T13:53:12.117100Z

a customized map-like data structure optimized for known usage patterns may make sense here. I don't know that records are the right answer. getting a clearer picture for the operations and their frequency is the first step though

ikitommi 2020-03-04T10:20:04.128900Z

Started to investigate this. Never used struct-maps, but good time to understand how they work (even if not suitable for this). My interest is in optimizing the read part and now think the best way to do it is a mix of protocols, lazy evaluation and a map-like custom type to make it ring-compatible. Thanks for the pointers.

ikitommi 2020-03-04T10:27:29.129100Z

the current full-copy request with ring/takes 2.4µs on my MacBook. Goal is get into <200ns for apps that only need anything but the non-normalized info (like headers) and a <50ns for the benchmark case of just uri & request-method.

ikitommi 2020-03-04T10:29:09.129300Z

writing the whole request into log will be as slow as full-copy, can't help with that.

ikitommi 2020-03-04T10:30:36.129500Z

memory allocation is also really important, need to test that too.

bronsa 2020-03-03T14:12:49.117500Z

changing a record means instantiating a new record how's that different from changing a map?

bronsa 2020-03-03T14:14:02.118200Z

perf differences of copying an array vs accessing all of a record's fields?

alexmiller 2020-03-03T14:20:43.120600Z

yeah, it's at least something that should be considered

bronsa 2020-03-03T14:20:56.120800Z

makes sense

bronsa 2020-03-03T16:19:52.121300Z

@alexmiller dunno if you get notified about jira comments (I don't anymore), but resolve introduces a bug

bronsa 2020-03-03T16:21:20.122500Z

if we don't want to open up the compiler, we could do it in a similar way as we do it for defn

bronsa 2020-03-03T16:21:24.122900Z

(if (clojure.lang.Util/equals nil (clojure.lang.Compiler$HostExpr/maybeSpecialTag tag))
                                (let [c (clojure.lang.Compiler$HostExpr/maybeClass tag false)]

alexmiller 2020-03-03T16:21:31.123100Z

you should get notified, but some of the "created by"/"updated by" metadata was broken in the migration - by default you should get notified if you created it, are watching, or voted for it

bronsa 2020-03-04T09:54:46.128700Z

thanks a lot!

alexmiller 2020-03-03T16:21:41.123400Z

what's the bug?

bronsa 2020-03-03T16:21:50.123800Z

user=&gt; (defprotocol p (^longs f [_]))
p
user=&gt; (set! *warn-on-reflection* true)
true
user=&gt; (defn foo [x] (aget (f x) 0))
Syntax error (IllegalArgumentException) compiling . at (REPL:1:15).
Unable to resolve classname: #'clojure.core/longs

alexmiller 2020-03-03T16:21:53.124Z

sorry, you prob put it on the ticket

alexmiller 2020-03-03T16:23:18.124600Z

seems like there should be tests to expose this

bronsa 2020-03-03T16:37:59.125Z

see -4

bronsa 2020-03-03T16:48:07.125200Z

I may not receive the emails I care about anymore, but Atlassian makes sure I get those sweet sweet spam ones :)

1😛
bronsa 2020-03-03T16:50:14.125700Z

is it possible to go back to receiving emails about issues created on my projects? I looked everywhere and couldn't find how to

alexmiller 2020-03-03T16:57:48.126300Z

I can probably fix that, will look at it later

bronsa 2020-03-03T16:58:23.126500Z

ty

alexmiller 2020-03-03T21:21:54.128Z

I've updated the notification scheme both for your projects and many others to have project lead notification like we had on the old jira

alexmiller 2020-03-03T21:24:05.128200Z

I looked at your settings and some of the project settings. in general, you should receive updates if a) you reported the issue, b) you are the assignee, or c) you are "watching" the issue. Now, in the projects where you are a lead, you should also get updates on issues in your projects.

alexmiller 2020-03-03T21:24:56.128400Z

if you find a specific issue and a specific event that you don't get an email for, let me know and they have a tool that can use all that info and tell me what notifications you should get and why