Logs: liberachat/#haskell
| 2021-06-23 21:30:58 | ← | safinaskar parts (~safinaska@109.252.90.89) () |
| 2021-06-23 21:30:59 | → | betelgeuse joins (~john2gb@94-225-47-8.access.telenet.be) |
| 2021-06-23 21:31:31 | × | fizbin quits (~fizbin@c-73-33-197-160.hsd1.nj.comcast.net) (Remote host closed the connection) |
| 2021-06-23 21:32:23 | → | derelict joins (~derelict@user/derelict) |
| 2021-06-23 21:33:05 | → | trcc_ joins (~trcc@eduroam09.au.dk) |
| 2021-06-23 21:33:48 | × | betelgeuse quits (~john2gb@94-225-47-8.access.telenet.be) (Read error: Connection reset by peer) |
| 2021-06-23 21:35:22 | → | betelgeuse joins (~john2gb@94-225-47-8.access.telenet.be) |
| 2021-06-23 21:36:02 | × | trcc quits (~trcc@users-1190.st.net.au.dk) (Ping timeout: 250 seconds) |
| 2021-06-23 21:37:20 | × | trcc_ quits (~trcc@eduroam09.au.dk) (Ping timeout: 250 seconds) |
| 2021-06-23 21:38:29 | × | betelgeuse quits (~john2gb@94-225-47-8.access.telenet.be) (Read error: Connection reset by peer) |
| 2021-06-23 21:38:40 | → | eggplantade joins (~Eggplanta@2600:1700:bef1:5e10:a50f:dc97:cbbc:9783) |
| 2021-06-23 21:39:21 | → | hammock joins (~Hammock@2600:1700:19a1:3330::625) |
| 2021-06-23 21:40:02 | → | betelgeuse joins (~john2gb@94-225-47-8.access.telenet.be) |
| 2021-06-23 21:40:12 | × | chisui quits (~chisui@200116b866efc300e1478aa720ae1876.dip.versatel-1u1.de) (Quit: Client closed) |
| 2021-06-23 21:40:19 | × | waleee quits (~waleee@2001:9b0:216:8200:d457:9189:7843:1dbd) (Ping timeout: 268 seconds) |
| 2021-06-23 21:42:12 | → | waleee joins (~waleee@h-98-128-228-119.NA.cust.bahnhof.se) |
| 2021-06-23 21:42:32 | × | dunkeln_ quits (~dunkeln@188.71.193.140) (Ping timeout: 250 seconds) |
| 2021-06-23 21:42:57 | × | betelgeuse quits (~john2gb@94-225-47-8.access.telenet.be) (Read error: Connection reset by peer) |
| 2021-06-23 21:42:58 | × | eggplantade quits (~Eggplanta@2600:1700:bef1:5e10:a50f:dc97:cbbc:9783) (Ping timeout: 250 seconds) |
| 2021-06-23 21:44:30 | → | betelgeuse joins (~john2gb@94-225-47-8.access.telenet.be) |
| 2021-06-23 21:44:54 | × | michalz quits (~michalz@185.246.204.114) (Remote host closed the connection) |
| 2021-06-23 21:47:17 | <pavonia> | I'm trying to map a replacement function over a list that replaces elements from a list with corresponding elements from another list, e.g. map (replace [1,3] [10,30]) [1,2,3,4] => [10,2,30,4]. Is there a way to make the lookup for each element take constant time? Both Map and HashMap seem to have logarithmic lookup time |
| 2021-06-23 21:47:18 | × | Erutuon quits (~Erutuon@user/erutuon) (Ping timeout: 250 seconds) |
| 2021-06-23 21:47:20 | × | betelgeuse quits (~john2gb@94-225-47-8.access.telenet.be) (Read error: Connection reset by peer) |
| 2021-06-23 21:48:45 | → | fizbin joins (~fizbin@c-73-33-197-160.hsd1.nj.comcast.net) |
| 2021-06-23 21:48:52 | → | betelgeuse joins (~john2gb@94-225-47-8.access.telenet.be) |
| 2021-06-23 21:49:42 | × | fizbin quits (~fizbin@c-73-33-197-160.hsd1.nj.comcast.net) (Remote host closed the connection) |
| 2021-06-23 21:50:24 | × | jao quits (jao@gateway/vpn/protonvpn/jao) (Ping timeout: 265 seconds) |
| 2021-06-23 21:51:52 | → | jao joins (~jao@cpc103048-sgyl39-2-0-cust502.18-2.cable.virginm.net) |
| 2021-06-23 21:52:06 | <dminuoso> | pavonia: how would that work, exactly? |
| 2021-06-23 21:52:25 | → | eggplantade joins (~Eggplanta@2600:1700:bef1:5e10:a50f:dc97:cbbc:9783) |
| 2021-06-23 21:53:32 | × | dhouthoo quits (~dhouthoo@178-117-36-167.access.telenet.be) (Quit: WeeChat 3.1) |
| 2021-06-23 21:54:20 | <pavonia> | I was thinking about a "real" hash map. Is the no Haskell implementation? |
| 2021-06-23 21:54:43 | <dminuoso> | a "real" hash map? constant time lookup? :-) |
| 2021-06-23 21:55:28 | × | betelgeuse quits (~john2gb@94-225-47-8.access.telenet.be) (Ping timeout: 246 seconds) |
| 2021-06-23 21:55:33 | <dminuoso> | That would requie perfect hashing |
| 2021-06-23 21:55:49 | <pavonia> | When you have a large case expression, what is the lookup time for this structure internally? |
| 2021-06-23 21:56:17 | <dminuoso> | Im not sure if GHC can translate this into a jump table |
| 2021-06-23 21:57:23 | <dminuoso> | It seems so |
| 2021-06-23 21:58:06 | <pavonia> | So which concrete data type would you suggest for fastest lookup? |
| 2021-06-23 21:58:29 | <dminuoso> | Id start by profiling and ensuring this is even worth the trouble.. |
| 2021-06-23 21:58:46 | <dminuoso> | Do you have actual prof data? Or is this just a case of premature optimization |
| 2021-06-23 21:59:22 | <pavonia> | It's more a theoretical question |
| 2021-06-23 21:59:59 | → | ec joins (~ec@gateway/tor-sasl/ec) |
| 2021-06-23 22:00:09 | <dminuoso> | Hard to answer a theoretical question. Improving performance usually depends on what you're doing exactly |
| 2021-06-23 22:00:13 | <pavonia> | That is performance doesn't matter in my case but I'm curious what would be the fastest lookup type |
| 2021-06-23 22:00:51 | <dminuoso> | From what I can gather case-of is constant time and fast if GHC can translate it into a jump table |
| 2021-06-23 22:01:54 | <dminuoso> | And then it depends on the scrutinee and the pattern clauses |
| 2021-06-23 22:02:07 | <pavonia> | But you can't build such a case-expression dynamically, can you? |
| 2021-06-23 22:02:35 | <dminuoso> | From what exactly? |
| 2021-06-23 22:03:11 | <dminuoso> | generally, Id probably just use HashMap from unordered-containers as a first step if I want quick access |
| 2021-06-23 22:03:30 | <dminuoso> | If that's not enough, then Id look into the specific issue at hand |
| 2021-06-23 22:03:57 | <pavonia> | For two lists as in the example above |
| 2021-06-23 22:04:12 | <pavonia> | So HashMap is generally faster than Map? |
| 2021-06-23 22:06:53 | <dminuoso> | Generally yes |
| 2021-06-23 22:07:12 | <dminuoso> | If the key is Int, then IntMap might (?) perform better, Im not sure |
| 2021-06-23 22:07:22 | <dminuoso> | Also, Id throw in bytestring-tries into the mix |
| 2021-06-23 22:07:37 | <dminuoso> | https://hackage.haskell.org/package/bytestring-trie |
| 2021-06-23 22:07:47 | → | trcc joins (~trcc@2-104-60-169-cable.dk.customer.tdc.net) |
| 2021-06-23 22:08:10 | <dminuoso> | pavonia: but keep in mind that HashMap is unordered |
| 2021-06-23 22:08:36 | × | raehik quits (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Ping timeout: 252 seconds) |
| 2021-06-23 22:08:37 | × | eggplantade quits (~Eggplanta@2600:1700:bef1:5e10:a50f:dc97:cbbc:9783) (Remote host closed the connection) |
| 2021-06-23 22:09:28 | × | derelict quits (~derelict@user/derelict) (Ping timeout: 246 seconds) |
| 2021-06-23 22:09:28 | <monochrom> | Premature generalization is the root of premature optimization. |
| 2021-06-23 22:10:58 | <monochrom> | Ultimately it may come down to just telling you about -ddump-simpl -ddump-stg -ddump-opt-cmm -ddump-asm so you can see what happens to your specific case. |
| 2021-06-23 22:11:30 | × | trcc quits (~trcc@2-104-60-169-cable.dk.customer.tdc.net) (Client Quit) |
| 2021-06-23 22:11:47 | <monochrom> | Because the other correct answer is "it depends". |
| 2021-06-23 22:12:02 | × | fendor quits (~fendor@178.165.189.179.wireless.dyn.drei.com) (Remote host closed the connection) |
| 2021-06-23 22:15:06 | × | __monty__ quits (~toonn@user/toonn) (Quit: leaving) |
| 2021-06-23 22:15:27 | → | machinedgod joins (~machinedg@24.105.81.50) |
| 2021-06-23 22:16:01 | <pavonia> | dminuoso: Okay, thanks |
| 2021-06-23 22:18:02 | → | killsushi joins (~killsushi@user/killsushi) |
| 2021-06-23 22:21:54 | × | brian_da_mage quits (~Neuromanc@user/briandamag) (Ping timeout: 264 seconds) |
| 2021-06-23 22:25:13 | × | wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Quit: Lost terminal) |
| 2021-06-23 22:27:40 | × | peterhil quits (~peterhil@dsl-hkibng32-54f849-252.dhcp.inet.fi) (Ping timeout: 252 seconds) |
| 2021-06-23 22:27:42 | → | peterhil_ joins (~peterhil@dsl-hkibng32-54f849-252.dhcp.inet.fi) |
| 2021-06-23 22:28:43 | × | vicfred quits (~vicfred@user/vicfred) (Quit: Leaving) |
| 2021-06-23 22:31:34 | → | raehik joins (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) |
| 2021-06-23 22:31:34 | → | wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) |
| 2021-06-23 22:31:51 | × | lavaman quits (~lavaman@98.38.249.169) (Remote host closed the connection) |
| 2021-06-23 22:32:00 | × | tzar_bomba quits (~tzar_bomb@78-56-41-78.static.zebra.lt) (Quit: Client closed) |
| 2021-06-23 22:33:25 | × | azeem quits (~azeem@dynamic-adsl-84-220-246-231.clienti.tiscali.it) (Ping timeout: 265 seconds) |
| 2021-06-23 22:33:32 | × | vicentius quits (~vicentius@user/vicentius) (Ping timeout: 252 seconds) |
| 2021-06-23 22:34:13 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-06-23 22:35:05 | <hseg> | are newtype family instances not representationally equal to what they wrap? |
| 2021-06-23 22:35:11 | → | Morrow joins (~Morrow@bzq-110-168-31-106.red.bezeqint.net) |
| 2021-06-23 22:35:19 | × | ephemient quits (uid407513@id-407513.tooting.irccloud.com) (Quit: Connection closed for inactivity) |
| 2021-06-23 22:36:00 | <hseg> | so given e.g. data family Sorted f; newtype instance Sorted [a] = SortedList {getSorted :: [a]} |
| 2021-06-23 22:36:14 | <hseg> | coerce :: Sorted [a] -> [a] is forbidden? |
| 2021-06-23 22:36:47 | → | azeem joins (~azeem@176.201.6.138) |
| 2021-06-23 22:38:14 | <hseg> | hrm... experimenting more shows this isn't what's going wrong, getting more data |
| 2021-06-23 22:42:57 | <hseg> | oh ffs. is there a reason the (unordered-)containers haddocks don't show role annotations? |
| 2021-06-23 22:44:22 | × | azeem quits (~azeem@176.201.6.138) (Read error: Connection reset by peer) |
| 2021-06-23 22:44:42 | × | Ariakenom quits (~Ariakenom@2001:9b1:efb:fc00:70b4:9739:defc:32cb) (Quit: Leaving) |
| 2021-06-23 22:45:18 | → | azeem joins (~azeem@dynamic-adsl-94-34-50-190.clienti.tiscali.it) |
| 2021-06-23 22:45:50 | × | jlamothe quits (~jlamothe@198.251.57.81) (Quit: leaving) |
| 2021-06-23 22:47:32 | × | tromp quits (~textual@dhcp-077-249-230-040.chello.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
| 2021-06-23 22:48:33 | → | jmcarthur joins (~jmcarthur@c-73-29-224-10.hsd1.nj.comcast.net) |
| 2021-06-23 22:50:38 | × | BosonCollider quits (~olofs@90-227-86-119-no542.tbcn.telia.com) (Ping timeout: 258 seconds) |
| 2021-06-23 22:51:02 | → | derelict joins (~derelict@user/derelict) |
All times are in UTC.