Commit Graph

58 Commits

Author SHA1 Message Date
Kobe Housen 8b460bc60f Use make size hint when copying channels in Nick()
70% faster when using a high number of channels

Old performance

```
$ go test ./state -bench=.
goos: linux
goarch: amd64
pkg: github.com/fluffle/goirc/state
cpu: AMD Ryzen Threadripper PRO 3945WX 12-Cores
BenchmarkNickSingleChan-24      15465226                76.35 ns/op
BenchmarkNickManyChan-24            5738            195721 ns/op
PASS
ok      github.com/fluffle/goirc/state  2.433s
```

new performance

```
$ go test ./state -bench=.
goos: linux
goarch: amd64
pkg: github.com/fluffle/goirc/state
cpu: AMD Ryzen Threadripper PRO 3945WX 12-Cores
BenchmarkNickSingleChan-24      15022640                79.13 ns/op
BenchmarkNickManyChan-24           10000            115104 ns/op
PASS
ok      github.com/fluffle/goirc/state  2.456s
```
2023-11-17 12:58:34 +00:00
Alex Bramley 08c1bcf174 Fix panic when String is called on nil mode pointers. Fixes #98. 2018-09-06 22:23:59 +01:00
Alex Bramley 47162eb0b8 Run gofmt to keep people happy! 2018-09-06 22:15:14 +01:00
Alex Bramley a7abc67ac2 Hold state tracker lock for Me(). Fixes data race panic. 2017-10-31 21:38:46 +00:00
Alex Bramley 5cf08f7e9c Remove race test in state tracker, go1.5 broke it. 2015-12-12 19:41:36 +00:00
kidanger ce963dc793 fix gmock url 2015-06-13 10:43:59 +01:00
Alex Bramley d11d209dcd Generate new tracker mock. 2014-12-31 17:50:03 +00:00
Alex Bramley ed6eb6115f Race test changes. 2014-12-31 17:37:08 +00:00
Alex Bramley c5830d598f Merge branch 'state-races' into state-copy
Test that races found in old code are no longer found in new code.
2014-12-31 17:32:15 +00:00
Alex Bramley 36e4aeb603 An attempt to trigger data races in the state tracker. 2014-12-31 17:31:50 +00:00
Alex Bramley f3c49069c0 The great state tracker privatisation 3/3: tracker. 2014-12-31 13:17:46 +00:00
Alex Bramley 4dd8bc72d5 The great state tracker privatisation 2/3: nicks. 2014-12-31 13:17:28 +00:00
Alex Bramley bffe946388 The great state tracker privatisation 1/3: channels. 2014-12-31 13:17:11 +00:00
Alex Bramley aff8b79dda state/channel: canonicalise order of returned nicks 2014-05-20 20:57:04 +01:00
Alex Bee 9f1f64cb09 Merge pull request #42 from StalkR/tracker
state/tracker_test: remove undefined init
2014-05-20 20:44:18 +01:00
StalkR 74716ceb70 state/tracker_test: remove undefined init 2014-05-15 13:28:57 +02:00
StalkR 89bcd2b78c state/nick: canonicalise the order of channels returned (map iteration is random) 2014-05-15 13:23:05 +02:00
Alex Bramley 5bb0c8278d Minimally invasive change to put logging behind a user-replaceable interface.
This could probably be done better, and there are probably awful caveats
and hidden gotchas with this approach. I REGRET NOTHING.
2013-09-27 22:19:40 +01:00
Alex Bramley 45d7b3317f Remove state.StateTracker stutter, hide it in Conn. 2013-02-16 11:29:56 +00:00
Alex Bramley ca46884c72 Remove embedded logger from state tracker. Hmmmm. 2013-01-23 22:33:01 +00:00
StalkR 68005e1845 state: parse +r/+Z channel modes 2013-01-10 22:22:19 +01:00
Alex Bee a4028ee669 Merge pull request #16 from StalkR/bot
state: nick: support for Bot mode (+B)
2013-01-06 11:21:14 -08:00
StalkR 2cc4e94acb state: nick: add Channels/ChannelsStr accessors to get channels a nick is on 2013-01-06 20:13:06 +01:00
StalkR 4962b26ca9 state: nick: support for Bot mode (+B) 2013-01-06 19:52:11 +01:00
StalkR eb92a84e96 state: channel: add Nicks() and NicksStr() accessors for nicks on channel 2013-01-06 19:29:53 +01:00
Alex Bramley c85f891c6b Bah, dsymonds moved gomock again. 2012-06-26 11:20:57 +01:00
Alex Bramley 3387f6fb99 Correct import path. 2012-02-03 23:45:41 +00:00
Alex Bramley 01d58fc748 Update weekly to reflect the new location of gomock. 2012-02-03 23:13:00 +00:00
Alex Bramley e0a5a57fe1 Merge branch 'master' into weekly
Conflicts:
	client/connection.go  # MERGED
	event/registry.go     # DELETED
	logging/mock_test.go  # DELETED
2011-11-13 14:13:55 +00:00
Alex Bramley 4e4c4b6798 Migrate to split logging pkg. 2011-11-13 14:02:12 +00:00
Alex Bramley 81eb9ee3df gofix weekly fixes for state. 2011-11-13 13:32:53 +00:00
Alex Bramley 69d52270b6 Convert state tracker to use gomock logging for tests. 2011-11-05 12:22:04 +00:00
Alex Bramley d0f0175d7f Oops. Missed String() from interface. 2011-11-05 09:30:32 +00:00
Alex Bramley b1037b2603 Add String() method for stateTracker. 2011-11-05 06:06:59 +00:00
Alex Bramley fdba74e8c0 Shave the yaks in state's tests. 2011-11-05 06:06:40 +00:00
Alex Bramley cfffcf2a85 Add a method to wipe a state tracker clean. 2011-11-05 02:25:25 +00:00
Alex Bramley 60cd5b975f Test Channel.ParseModes(). 2011-11-03 04:15:12 +00:00
Alex Bramley 2a6f19dc83 Start of channel tests. 2011-11-03 03:12:32 +00:00
Alex Bramley b88983ceaf Test Nick.ParseModes(). 2011-11-03 03:01:50 +00:00
Alex Bramley 75112d67e2 More nick tests. 2011-10-27 18:43:34 +01:00
Alex Bramley 1c39dbecbb Remove extraneous logging level setting. 2011-10-27 18:43:08 +01:00
Alex Bramley 748db6b5d2 Test for dissociation, also ensure both nick and channel passed to {A,Di}ssociate are currently tracked. 2011-10-27 17:54:23 +01:00
Alex Bramley 47dd5b3430 We need to be able to get at ChanPrivs easily. 2011-10-27 17:03:01 +01:00
Alex Bramley 2603e0984c Test nick <-> channel association. 2011-10-27 16:55:33 +01:00
Alex Bramley 93508c79f1 Similar nick <-> channel dissociation tests in DelChannel(). 2011-10-27 16:41:56 +01:00
Alex Bramley 8771f1db77 Test nick<->channel dissociation in DelNick(). 2011-10-27 16:04:45 +01:00
Alex Bramley 6ded98b9e5 Moar testing and updates. 2011-10-22 23:58:06 +01:00
Alex Bramley 1fbd0a8b17 Switch to using and propagating logger. 2011-10-22 23:57:22 +01:00
Alex Bramley 7be7e79c78 Oops, missed a bit. 2011-10-20 00:23:54 +01:00
Alex Bramley 111a23d87c Epic refactor of the refactor. 2011-10-20 00:10:33 +01:00