Ticket #605 (new task: None)

Opened 9 years ago

Last modified 4 months ago

Optimisation: strict enumerations

Reported by: simonmar Owned by:
Priority: normal Milestone: _|_
Component: Compiler Version: None
Keywords: Cc: Bulat.Ziganshin@…, id@…, pho@…, hackage.haskell.org@…, tibbe, dterei
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Runtime performance bug Difficulty: Difficult (2-5 days)
Test Case: N/A Blocked By:
Blocking: Related Tickets: #6135

Description (last modified by igloo) (diff)

Strict enumeration types should be implemented by Int#, both in the strictness analyser and for constructor fields annotated with {-# UNPACK #-}.

Change History

  Changed 7 years ago by simonmar

  • difficulty set to Difficult (1 week)
  • os set to Unknown
  • architecture set to Unknown
  • description modified (diff)

  Changed 7 years ago by igloo

  • testcase set to N/A
  • description modified (diff)
  • milestone set to 6.8

  Changed 6 years ago by guest

  • cc Bulat.Ziganshin@… added

  Changed 6 years ago by Isaac Dupree

  • cc id@… added

  Changed 6 years ago by simonmar

  • milestone changed from 6.8 branch to _|_

We get much of the benefit of this optimisation from pointer-tagging (in 6.8.1), so the payoff will be less. Probably still worth doing, but not as important now.

  Changed 5 years ago by simonmar

  • architecture changed from Unknown to Unknown/Multiple

  Changed 5 years ago by simonmar

  • os changed from Unknown to Unknown/Multiple

  Changed 4 years ago by PHO

  • cc pho@… added

  Changed 4 years ago by simonmar

  • difficulty changed from Difficult (1 week) to Difficult (2-5 days)

  Changed 3 years ago by igloo

  • failure set to Runtime performance bug

  Changed 2 years ago by liyang

  • cc hackage.haskell.org@… added

  Changed 2 years ago by simonmar

Also requested in #4936

  Changed 2 years ago by simonpj

  • cc tibbe added

I'd still like to see a test program showing the existing setup, compared what you get with manual unboxing of enumerations. That would give us an idea of whether there's a real perf win here.

Simon

follow-up: ↓ 15   Changed 2 years ago by rl

Wouldn't this make boxed enumeration values (esp. Bool) larger by a word?

in reply to: ↑ 14   Changed 2 years ago by tibbe

Replying to rl:

Wouldn't this make boxed enumeration values (esp. Bool) larger by a word?

Yes, unless they are also unpacked.

follow-up: ↓ 17   Changed 2 years ago by rl

I think there is actually a subtle difference between #4936 and this ticket. #4936 proposes to represent enumerations as Int which would indeed make boxed enumeration values bigger. This ticket proposes to keep the representation of boxed values as it is now but to unbox them to Int# when possible. This seems more efficient.

in reply to: ↑ 16   Changed 2 years ago by tibbe

Replying to rl:

I think there is actually a subtle difference between #4936 and this ticket. #4936 proposes to represent enumerations as Int which would indeed make boxed enumeration values bigger. This ticket proposes to keep the representation of boxed values as it is now but to unbox them to Int# when possible. This seems more efficient.

Yes. I think only transforming strict enumerations (to an Int#) is enough. No need to change non-strict enumerations to an Int.

  Changed 4 months ago by dterei

  • cc dterei added

  Changed 4 months ago by dterei

  • related set to #6135
Note: See TracTickets for help on using tickets.