Commit graph

3640 commits

Author SHA1 Message Date
Alexander Wang
0e8fa7cd8f
Merge pull request #1672 from Juneezee/master
lib/color: avoid unnecessary byte/string conversion
2023-10-18 11:48:09 -07:00
Eng Zer Jun
5c2d468058
lib/color: avoid unnecessary byte/string conversion
We can use `(*regexp.Regexp).MatchString` instead of
`(*regexp.Regexp).Match([]byte(...))` to avoid unnecessary `[]byte`
conversions and reduce allocations.

Example benchmark:

func BenchmarkMatch(b *testing.B) {
	for i := 0; i < b.N; i++ {
		if match := themeColorRegex.Match([]byte("N1")); !match {
			b.Fail()
		}
	}
}

func BenchmarkMatchString(b *testing.B) {
	for i := 0; i < b.N; i++ {
		if match := themeColorRegex.MatchString("N1"); !match {
			b.Fail()
		}
	}
}

goos: linux
goarch: amd64
pkg: oss.terrastruct.com/d2/lib/color
cpu: AMD Ryzen 7 PRO 4750U with Radeon Graphics
BenchmarkMatch-16          	 9894165	       114.3 ns/op	       2 B/op	       1 allocs/op
BenchmarkMatchString-16    	13439838	        83.61 ns/op	       0 B/op	       0 allocs/op
PASS
ok  	oss.terrastruct.com/d2/lib/color	3.306s

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2023-10-18 23:30:11 +08:00
gavin-ts
a3a685d96f
Merge pull request #1670 from gavin-ts/grid-image-label
update grid cell's label/icon positioning
2023-10-17 12:07:05 -07:00
Gavin Nishizawa
00a3d32d81
cleanup, comment 2023-10-16 20:37:56 -07:00
Gavin Nishizawa
dd34d3a887
update tests 2023-10-16 17:39:56 -07:00
Gavin Nishizawa
bd6c1d1af1
update sizing adjustments pre/post grid layout 2023-10-16 17:34:30 -07:00
Gavin Nishizawa
04a64e46c3
changelog 2023-10-16 16:54:58 -07:00
Gavin Nishizawa
85becde1da
update tests 2023-10-16 16:48:00 -07:00
Gavin Nishizawa
e77c7a20a6
update test 2023-10-16 16:45:44 -07:00
Gavin Nishizawa
514bb89472
improve margin adjustments for outside labels 2023-10-16 16:45:18 -07:00
Gavin Nishizawa
c647c6fb2e
update grid cell label/icon positioning 2023-10-16 16:45:18 -07:00
Gavin Nishizawa
69ad220acd
more difficult test 2023-10-16 16:45:12 -07:00
Gavin Nishizawa
3df57f84da
add grid_image_label_position test 2023-10-16 15:44:26 -07:00
Alexander Wang
fe0006b290
Update next.md 2023-10-14 21:58:26 -07:00
Alexander Wang
0c7a4b66b7
Merge pull request #1660 from landmaj/master
fix invisible null constraints in sql_table
2023-10-13 10:14:17 -07:00
Michał Wieluński
448b51c345
fix invisible null constraints in sql_table
fixes #1655
2023-10-13 10:33:38 +02:00
gavin-ts
4e73736dd0
Merge pull request #1661 from gavin-ts/fix-ci-commit-ssh-sig-check
update ci with fix for ssh signatures
2023-10-12 15:04:37 -07:00
Gavin Nishizawa
3fe2943c1c
update ci with fix for ssh signatures 2023-10-12 13:52:49 -07:00
gavin-ts
1383464dfc
Merge pull request #1645 from gavin-ts/check-for-commit-signatures
workflow check for commit signatures
2023-10-06 16:23:02 -07:00
gavin-ts
318e628c78
Merge pull request #1643 from gavin-ts/fix-var-in-glob
Fix panic with var in glob
2023-10-06 16:20:24 -07:00
Gavin Nishizawa
f200c19e31
d2oracle Equals 2023-10-06 15:48:19 -07:00
gavin-ts
db126ab477
Merge pull request #1646 from gavin-ts/fix-grid-rows-gap-bug
Fix grid rows gap bug
2023-10-06 15:20:46 -07:00
Gavin Nishizawa
5b4818aefa
changelog 2023-10-05 18:57:04 -07:00
Gavin Nishizawa
9797f5503f
update tests 2023-10-05 18:52:28 -07:00
Gavin Nishizawa
7a7d3edc3c
update test 2023-10-05 18:49:38 -07:00
Gavin Nishizawa
aca528c9e1
fix typo bug 2023-10-05 18:48:59 -07:00
Gavin Nishizawa
6bae0255e6
add grid_rows_gap_bug test 2023-10-05 18:48:29 -07:00
Gavin Nishizawa
0665b1bd3b
workflow check for commit signatures 2023-10-05 18:04:20 -07:00
gavin-ts
65fd4b79b1
Merge pull request #1621 from landmaj/master
add MkDocs Plugin to community plugins
2023-10-05 17:50:26 -07:00
Michał Wieluński
77ca86bc4f
add MkDocs Plugin to community plugins 2023-10-05 23:07:58 +02:00
Gavin Nishizawa
1a4001d56e
remove e2e test 2023-10-05 13:13:19 -07:00
Gavin Nishizawa
142f637b6a
add compile test 2023-10-05 13:11:03 -07:00
Gavin Nishizawa
47251006ae
changelog 2023-10-05 12:18:38 -07:00
Gavin Nishizawa
8a4f970c5f
test success 2023-10-05 11:26:25 -07:00
Gavin Nishizawa
2fb7058ab6
handle nil Keys in Equals 2023-10-05 11:26:25 -07:00
Gavin Nishizawa
8d6dc9b19a
add var_in_glob test 2023-10-05 11:26:25 -07:00
gavin-ts
c49bc8e847
Merge pull request #1631 from gavin-ts/simple_edges_across_diagrams
Simple edges across nested diagrams
2023-10-02 11:30:36 -07:00
Gavin Nishizawa
501f44b13f
update compile test 2023-10-02 11:05:20 -07:00
Gavin Nishizawa
84affc96d1
add validation for sequence diagram edges to descendant 2023-10-02 11:05:20 -07:00
Gavin Nishizawa
a8af739064
update compile test for edges to descendant from subgraph container 2023-10-02 11:05:20 -07:00
Gavin Nishizawa
fd2f705b03
changelog 2023-10-02 11:05:20 -07:00
Gavin Nishizawa
2be1f23c83
update tests 2023-10-02 11:05:20 -07:00
Gavin Nishizawa
2a9acd06aa
cleanup validation 2023-10-02 11:05:19 -07:00
Gavin Nishizawa
b41a9e4e96
update validation and test 2023-10-02 11:05:19 -07:00
Gavin Nishizawa
a03d9bd24e
update test 2023-10-02 11:05:19 -07:00
Gavin Nishizawa
97488fe2d8
updating validation 2023-10-02 11:05:19 -07:00
Gavin Nishizawa
016ff3723d
update test 2023-10-02 11:05:19 -07:00
Gavin Nishizawa
2f71d575df
handle lifeline edges 2023-10-02 11:05:19 -07:00
Gavin Nishizawa
2fe494f678
re-associate edge references after nested layout 2023-10-02 11:05:19 -07:00
Gavin Nishizawa
7bb56ce153
expand test 2023-10-02 11:05:19 -07:00