Commit Graph

928 Commits

Author SHA1 Message Date
Jonathan Daugherty
345f66bba5
Merge pull request #234 from iphydf/unpack
perf: Mark event data types as strict; unpack some fields.
2022-03-09 14:47:46 -08:00
iphydf
9b9635b86b
perf: Mark event data types as strict; unpack some fields.
Integral types like Char and Int benefit a lot from UNPACK. For these,
there is also very little reason to use lazy fields, especially in this
codebase where most computations don't need laziness.
2022-03-09 22:44:24 +00:00
Jonathan Daugherty
d6a069401e
Merge pull request #232 from iphydf/speedup-large-paste
perf: Improve performance for large bracketed pastes.
2022-03-09 11:33:11 -08:00
iphydf
6b8d0639c3
perf: Improve performance for large bracketed pastes.
The current algorithm has polynomial time complexity. The new algorithm
runs in linear time and is generally much more efficient because it
operates on packed byte strings instead of linked lists of Char.

Some timing:
* 100KB: 1 second
* 200KB: 2.5 seconds
* 300KB: 4 seconds
* 400KB: 7 seconds
* 500KB: 12 seconds
* 600KB: 16 seconds
* 700KB: 22 seconds

As we can see, it's still `O(n^2)` overall, probably because of the
calls to `bracketedPasteFinished`. I'll investigate that next. The
constant factor overall is much lower now:
```
Before: 2.866E-6n^3  - 1.784E-4n^2 + 0.114n - 2.622
After:  -1.389E-8n^3 + 5.53E-5n^2  - 1.604E-3n + 0.273
```
2022-03-09 18:49:34 +00:00
Jonathan Daugherty
b3504fbcb0 Bump version, update changelog 2022-02-27 15:23:39 -08:00
Jonathan Daugherty
9891504cfb Fix Cursor constructor documentation order (fixes #229) 2022-01-10 15:36:02 -08:00
Jonathan Daugherty
f8f45c2af5 Remove Monoid and Semigroup instances for Attr and MaybeDefault (relevant to brick/#351)
This change removes the aforementioned instances because they were
misbehaved; merging Attr and MaybeDefault values with these instances
resulted in field value losses. For example, before this change,

  (defAttr `withForeColor` blue) <> (defAttr `withBackColor` green)

would result in just

  (defAttr `withBackColor` green)

because the instances were designed to favor the right-hand arguments'
fields even if they had not been explicitly set (a consequence of the
MaybeDefault Semigroup instance). While that behavior was sensible
specifically in the context of Graphics.Vty.Inline, it wasn't a useful
user-facing API and it made for surprising instance behavior. Since
there is actually no good way to handle this in a Semigroup instance for
Attr -- some choices have to be made about how to merge two attributes'
foreground colors, and that won't be much better than what we had -- the
instance was just removed. I suspect that the risk of this impacting
users negatively is very low, given that the instance behavior was not
very useful.
2021-11-23 15:41:02 -08:00
Jonathan Daugherty
67b25158f9
Merge pull request #228 from mlang/NFData
NFData instance for Event
2021-07-16 08:59:00 -07:00
Mario Lang
a6c346b410 NFData instance for Event 2021-07-16 13:59:16 +02:00
Jonathan Daugherty
abf7fc4cd7 Remove defunct Eq contraints on Semigroup and Monoid instances for MaybeDefault 2021-06-28 05:27:51 -07:00
Jonathan Daugherty
fe501ccf27
Merge pull request #225 from hapytex/improvement/maybedefault-semigroup
A simpler version of the Semigroup instance for MaybeDefault
2021-06-11 05:45:18 -07:00
Willem Van Onsem
b1d5762e0e
revert irrefutable pattern 2021-06-11 08:00:29 +02:00
Willem Van Onsem
e98e94870e
import semigroup 2021-06-10 23:22:57 +02:00
Willem Van Onsem
81b6151d51
irrefutable pattern 2021-06-10 23:15:48 +02:00
Willem Van Onsem
ed04989938
more simplification 2021-06-10 23:15:02 +02:00
Willem Van Onsem
380b618bbf
fix spacing 2021-06-10 23:00:49 +02:00
Willem Van Onsem
e83882c35b
add missing test file 2021-06-10 22:55:31 +02:00
Willem Van Onsem
000f901a93
simplify the Semigroup instance of MaybeDefault 2021-06-10 22:52:17 +02:00
Jonathan Daugherty
fa74b0ae1c
Merge pull request #217 from felixonmars/patch-2
Fix upper bound for `random`
2021-02-24 11:24:29 -08:00
Felix Yan
c0d38a16ba
Fix upper bound for random
It was missing in 05b65fc5bc (diff-bbe7cbd3346ad764f4c6f56880116550ee4f4a768d2a578ede1c0ce22b36fb4f)
2021-02-25 03:13:47 +08:00
Jonathan Daugherty
e953272793 Bump version, update changelog 2021-02-22 17:39:10 -08:00
Jonathan Daugherty
62f5ea36e8
Merge pull request #215 from hapytex/hlint/remove-unused-pragmas
Remove unused LANGUAGE pragmas
2021-02-18 07:30:49 -08:00
Jonathan Daugherty
b21145850c
Merge pull request #216 from hapytex/hlint/redundant-dollar
remove redundant $s
2021-02-18 06:52:28 -08:00
Willem Van Onsem
68ec269cf5
remove redundant $s 2021-02-18 07:40:26 +01:00
Willem Van Onsem
b91829353f remove unused BangPatterns 2021-02-18 07:24:07 +01:00
Willem Van Onsem
152d3d6c07 remove unused NamedFieldPuns 2021-02-18 07:21:23 +01:00
Jonathan Daugherty
fdad9586c4
Merge pull request #214 from hapytex/hlint/atomically-to-io
use readTVarIO and newTVarIO as specialized atomic versions of readTV…
2021-02-17 14:48:41 -08:00
Willem Van Onsem
f0fb92aca0 use readTVarIO and newTVarIO as specialized atomic versions of readTVar and newTVar 2021-02-17 23:46:15 +01:00
Jonathan Daugherty
003f491a43
Merge pull request #212 from hapytex/hlint/group-import
Hlint/group import
2021-02-17 14:41:10 -08:00
Jonathan Daugherty
2a881950de
Merge pull request #213 from hapytex/hlint/use-head
Use head over !!0
2021-02-17 14:40:57 -08:00
Willem Van Onsem
a803a2ad72 use head over !!0 2021-02-17 23:38:49 +01:00
Willem Van Onsem
194cd8502c group import 2021-02-17 23:35:49 +01:00
Willem Van Onsem
e886dc0f83
Merge pull request #2 from jtdaugherty/master
sync
2021-02-17 07:43:55 +01:00
Jonathan Daugherty
309c0e4824
Merge pull request #209 from hapytex/improvement/simplify-color
rewrite the color logic
2021-02-16 13:34:13 -08:00
Willem Van Onsem
9605e5f2fb added test to check equivalence with the old implementation 2021-02-16 22:21:00 +01:00
Jonathan Daugherty
bf0874598f combinedOpsForLayers: fix 2021-02-16 13:10:06 -08:00
Jonathan Daugherty
f5b7222065
Merge pull request #196 from lehins/master
Update upper bounds for `random`
2021-02-16 13:07:55 -08:00
Jonathan Daugherty
f0f729d755
Merge pull request #202 from hapytex/hlint/eta-reduction
eta reductions
2021-02-16 09:45:47 -08:00
Jonathan Daugherty
572c59881b
Merge pull request #203 from hapytex/hlint/use-fmap
make use of <$>
2021-02-16 09:44:49 -08:00
Willem Van Onsem
9eaa5e5cb5 16 iso 15 2021-02-16 13:27:46 +01:00
Willem Van Onsem
598b0148b6
Merge pull request #1 from jtdaugherty/master
sync
2021-02-16 12:19:13 +01:00
Willem Van Onsem
ffdd86df1c rewrite the color logic 2021-02-16 12:15:12 +01:00
Willem Van Onsem
f2c58a1870 extra improvements 2021-02-16 09:26:54 +01:00
Jonathan Daugherty
dfa4c1ec08
Merge pull request #207 from hapytex/hlint/redundant-bracket
remove useless parenthesis and ellipse
2021-02-15 15:58:45 -08:00
Willem Van Onsem
9c479554ee revert pattern brackets 2021-02-15 23:59:25 +01:00
Jonathan Daugherty
ab621ee8a4
Merge pull request #204 from hapytex/hlint/remove-lambda
avoid lambda expressions
2021-02-15 14:48:32 -08:00
Jonathan Daugherty
7f8d21b8d6
Merge pull request #205 from hapytex/hlint/use-string
use String over [Char]
2021-02-15 14:43:08 -08:00
Willem Van Onsem
0e5c1646f6 remove useless parenthesis and ellipse 2021-02-15 23:07:09 +01:00
Willem Van Onsem
bed8068d37 use String over [Char] 2021-02-15 17:42:45 +01:00
Willem Van Onsem
b5da64bb63 avoid lambda expressions 2021-02-15 17:39:53 +01:00