Skip to content

test: 100% library coverage + Codecov OIDC fix#4

Merged
kolkov merged 3 commits into
mainfrom
test/coverage-100
Mar 3, 2026
Merged

test: 100% library coverage + Codecov OIDC fix#4
kolkov merged 3 commits into
mainfrom
test/coverage-100

Conversation

@kolkov
Copy link
Copy Markdown
Contributor

@kolkov kolkov commented Mar 3, 2026

Summary

  • Achieve 100% test coverage on library package (was 96.4%)
  • Fix Codecov integration (OIDC, no token needed)

Tests added

  • TestIsExtendedPictographic_AllRanges — all 8 range branches + switch + negatives
  • TestAsciiWidth — empty string, SWAR fast/slow paths, control chars, scalar tail
  • TestAsciiWidth_SWARControlAtEveryPosition — control at each byte offset in 8-byte chunk
  • TestStringWidth_ASCIIControlMix — end-to-end ASCII with control characters

Codecov fix

  • file:files: (v5 breaking change, old param was silently ignored)
  • use_oidc: true + id-token: write permission (no secret needed)

Test plan

  • go test -cover → 100.0% of statements
  • All existing tests still pass
  • CI passes on GitHub
  • Codecov badge updates after merge

- Add exhaustive tests for isExtendedPictographic (all Unicode ranges)
- Add direct unit tests for asciiWidth (SWAR fast/slow paths, control chars)
- Add StringWidth ASCII control character delegation tests
- Fix Codecov: file → files (v5), use OIDC auth (no token needed)
- Update README and CHANGELOG with 100% coverage
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 3, 2026

Library Comparison

Scenario uniwidth go-runewidth uniseg vs runewidth vs uniseg Winner
RuneWidth ASCII 2.186 ns 2.526 ns — ns 1.1x uniwidth
RuneWidth CJK 2.831 ns 22.54 ns — ns 7.9x uniwidth
RuneWidth Emoji 2.496 ns 13.67 ns — ns 5.4x uniwidth
StringWidth ASCII Long 67.10 ns 3466 ns 5160 ns 51.6x 76.9x uniwidth
StringWidth ASCII Medium 16.21 ns 643.5 ns 965.6 ns 39.6x 59.5x uniwidth
StringWidth ASCII Short 5.658 ns 75.51 ns 113.6 ns 13.3x 20.0x uniwidth
StringWidth CJK Medium 762.1 ns 1563 ns 2044 ns 2.0x 2.6x uniwidth
StringWidth CJK Short 75.19 ns 159.0 ns 210.9 ns 2.1x 2.8x uniwidth
StringWidth Combined 290.9 ns 404.8 ns 708.7 ns 1.3x 2.4x uniwidth
StringWidth Emoji Medium 690.8 ns 1038 ns 1460 ns 1.5x 2.1x uniwidth
StringWidth Emoji Short 161.6 ns 269.3 ns 404.2 ns 1.6x 2.5x uniwidth
StringWidth Flags 112.0 ns 236.5 ns 311.2 ns 2.1x 2.7x uniwidth
StringWidth Mixed Medium 567.1 ns 899.0 ns 1258 ns 1.5x 2.2x uniwidth
StringWidth Mixed Short 159.0 ns 256.7 ns 366.6 ns 1.6x 2.3x uniwidth
StringWidth TUI Prompt 170.8 ns 277.0 ns 387.3 ns 1.6x 2.2x uniwidth
StringWidth TUI StatusLine 624.4 ns 942.0 ns 1323 ns 1.5x 2.1x uniwidth
StringWidth TUI TableHeader 591.2 ns 682.2 ns 947.0 ns 1.1x 1.6x uniwidth
StringWidth ZWJ 191.5 ns 219.9 ns 487.6 ns 1.1x 2.5x uniwidth
Raw benchmark output
goos: linux
goarch: amd64
pkg: github.com/unilibs/uniwidth/bench
cpu: AMD EPYC 7763 64-Core Processor                
BenchmarkRuneWidth_ASCII_Uniwidth-4                  	47259872	         2.183 ns/op	       0 B/op	       0 allocs/op
BenchmarkRuneWidth_ASCII_Uniwidth-4                  	52910425	         2.288 ns/op	       0 B/op	       0 allocs/op
BenchmarkRuneWidth_ASCII_Uniwidth-4                  	54766770	         2.186 ns/op	       0 B/op	       0 allocs/op
BenchmarkRuneWidth_ASCII_GoRunewidth-4               	46757302	         2.526 ns/op	       0 B/op	       0 allocs/op
BenchmarkRuneWidth_ASCII_GoRunewidth-4               	48194089	         2.517 ns/op	       0 B/op	       0 allocs/op
BenchmarkRuneWidth_ASCII_GoRunewidth-4               	38068626	         2.735 ns/op	       0 B/op	       0 allocs/op
BenchmarkRuneWidth_CJK_Uniwidth-4                    	42295585	         2.831 ns/op	       0 B/op	       0 allocs/op
BenchmarkRuneWidth_CJK_Uniwidth-4                    	42468554	         2.838 ns/op	       0 B/op	       0 allocs/op
BenchmarkRuneWidth_CJK_Uniwidth-4                    	41457105	         2.823 ns/op	       0 B/op	       0 allocs/op
BenchmarkRuneWidth_CJK_GoRunewidth-4                 	 5387690	        22.54 ns/op	       0 B/op	       0 allocs/op
BenchmarkRuneWidth_CJK_GoRunewidth-4                 	 5230878	        22.52 ns/op	       0 B/op	       0 allocs/op
BenchmarkRuneWidth_CJK_GoRunewidth-4                 	 5215110	        23.11 ns/op	       0 B/op	       0 allocs/op
BenchmarkRuneWidth_Emoji_Uniwidth-4                  	44300548	         2.492 ns/op	       0 B/op	       0 allocs/op
BenchmarkRuneWidth_Emoji_Uniwidth-4                  	48061569	         2.496 ns/op	       0 B/op	       0 allocs/op
BenchmarkRuneWidth_Emoji_Uniwidth-4                  	48096962	         2.508 ns/op	       0 B/op	       0 allocs/op
BenchmarkRuneWidth_Emoji_GoRunewidth-4               	 8643584	        13.67 ns/op	       0 B/op	       0 allocs/op
BenchmarkRuneWidth_Emoji_GoRunewidth-4               	 8568958	        13.82 ns/op	       0 B/op	       0 allocs/op
BenchmarkRuneWidth_Emoji_GoRunewidth-4               	 8296316	        13.67 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ASCII_Short_Uniwidth-4          	21234327	         5.658 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ASCII_Short_Uniwidth-4          	19694481	         5.674 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ASCII_Short_Uniwidth-4          	20791345	         5.622 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ASCII_Short_GoRunewidth-4       	 1592334	        75.51 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ASCII_Short_GoRunewidth-4       	 1601173	        75.07 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ASCII_Short_GoRunewidth-4       	 1607368	        75.64 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ASCII_Short_Uniseg-4            	 1000000	       113.6 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ASCII_Short_Uniseg-4            	 1000000	       113.9 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ASCII_Short_Uniseg-4            	 1000000	       113.1 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ASCII_Medium_Uniwidth-4         	 7459512	        16.17 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ASCII_Medium_Uniwidth-4         	 7320124	        16.22 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ASCII_Medium_Uniwidth-4         	 7390873	        16.21 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ASCII_Medium_GoRunewidth-4      	  184494	       648.2 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ASCII_Medium_GoRunewidth-4      	  169012	       642.3 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ASCII_Medium_GoRunewidth-4      	  168844	       643.5 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ASCII_Medium_Uniseg-4           	  115156	       966.2 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ASCII_Medium_Uniseg-4           	  124275	       965.6 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ASCII_Medium_Uniseg-4           	  125472	       963.8 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ASCII_Long_Uniwidth-4           	 1783178	        67.22 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ASCII_Long_Uniwidth-4           	 1787841	        66.94 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ASCII_Long_Uniwidth-4           	 1773504	        67.10 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ASCII_Long_GoRunewidth-4        	   34144	      3477 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ASCII_Long_GoRunewidth-4        	   34659	      3466 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ASCII_Long_GoRunewidth-4        	   33952	      3460 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ASCII_Long_Uniseg-4             	   23076	      5160 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ASCII_Long_Uniseg-4             	   23450	      5142 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ASCII_Long_Uniseg-4             	   23067	      5164 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_CJK_Short_Uniwidth-4            	 1597032	        75.19 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_CJK_Short_Uniwidth-4            	 1594068	        74.87 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_CJK_Short_Uniwidth-4            	 1584444	        75.48 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_CJK_Short_GoRunewidth-4         	  757195	       159.8 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_CJK_Short_GoRunewidth-4         	  759958	       159.0 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_CJK_Short_GoRunewidth-4         	  757388	       157.9 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_CJK_Short_Uniseg-4              	  524889	       211.4 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_CJK_Short_Uniseg-4              	  537975	       208.5 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_CJK_Short_Uniseg-4              	  567732	       210.9 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_CJK_Medium_Uniwidth-4           	  145738	       754.8 ns/op	     144 B/op	       1 allocs/op
BenchmarkStringWidth_CJK_Medium_Uniwidth-4           	  150462	       769.0 ns/op	     144 B/op	       1 allocs/op
BenchmarkStringWidth_CJK_Medium_Uniwidth-4           	  157532	       762.1 ns/op	     144 B/op	       1 allocs/op
BenchmarkStringWidth_CJK_Medium_GoRunewidth-4        	   75470	      1559 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_CJK_Medium_GoRunewidth-4        	   77227	      1565 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_CJK_Medium_GoRunewidth-4        	   69400	      1563 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_CJK_Medium_Uniseg-4             	   59380	      2014 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_CJK_Medium_Uniseg-4             	   59640	      2044 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_CJK_Medium_Uniseg-4             	   59270	      2185 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Mixed_Short_Uniwidth-4          	  630590	       166.0 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Mixed_Short_Uniwidth-4          	  754219	       157.8 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Mixed_Short_Uniwidth-4          	  763635	       159.0 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Mixed_Short_GoRunewidth-4       	  468387	       256.1 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Mixed_Short_GoRunewidth-4       	  467616	       257.0 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Mixed_Short_GoRunewidth-4       	  465236	       256.7 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Mixed_Short_Uniseg-4            	  327202	       367.4 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Mixed_Short_Uniseg-4            	  327422	       366.5 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Mixed_Short_Uniseg-4            	  328599	       366.6 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Mixed_Medium_Uniwidth-4         	  181468	       560.8 ns/op	     192 B/op	       1 allocs/op
BenchmarkStringWidth_Mixed_Medium_Uniwidth-4         	  180806	       572.3 ns/op	     192 B/op	       1 allocs/op
BenchmarkStringWidth_Mixed_Medium_Uniwidth-4         	  186541	       567.1 ns/op	     192 B/op	       1 allocs/op
BenchmarkStringWidth_Mixed_Medium_GoRunewidth-4      	  125026	       899.0 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Mixed_Medium_GoRunewidth-4      	  134456	       891.0 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Mixed_Medium_GoRunewidth-4      	  133376	       906.6 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Mixed_Medium_Uniseg-4           	   95647	      1253 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Mixed_Medium_Uniseg-4           	   95524	      1258 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Mixed_Medium_Uniseg-4           	   95287	      1263 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Emoji_Short_Uniwidth-4          	  737056	       162.5 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Emoji_Short_Uniwidth-4          	  754276	       160.6 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Emoji_Short_Uniwidth-4          	  742065	       161.6 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Emoji_Short_GoRunewidth-4       	  450231	       275.1 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Emoji_Short_GoRunewidth-4       	  448746	       265.7 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Emoji_Short_GoRunewidth-4       	  450810	       269.3 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Emoji_Short_Uniseg-4            	  303745	       404.2 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Emoji_Short_Uniseg-4            	  303052	       405.6 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Emoji_Short_Uniseg-4            	  268498	       401.8 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Emoji_Medium_Uniwidth-4         	  154891	       690.8 ns/op	     240 B/op	       1 allocs/op
BenchmarkStringWidth_Emoji_Medium_Uniwidth-4         	  156340	       673.8 ns/op	     240 B/op	       1 allocs/op
BenchmarkStringWidth_Emoji_Medium_Uniwidth-4         	  158772	       700.0 ns/op	     240 B/op	       1 allocs/op
BenchmarkStringWidth_Emoji_Medium_GoRunewidth-4      	  111798	      1020 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Emoji_Medium_GoRunewidth-4      	  108435	      1067 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Emoji_Medium_GoRunewidth-4      	  119144	      1038 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Emoji_Medium_Uniseg-4           	   83197	      1460 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Emoji_Medium_Uniseg-4           	   83727	      1494 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Emoji_Medium_Uniseg-4           	   83433	      1444 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_TUI_Prompt_Uniwidth-4           	  705762	       173.1 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_TUI_Prompt_Uniwidth-4           	  706183	       170.8 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_TUI_Prompt_Uniwidth-4           	  704250	       170.0 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_TUI_Prompt_GoRunewidth-4        	  437559	       277.0 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_TUI_Prompt_GoRunewidth-4        	  441531	       287.2 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_TUI_Prompt_GoRunewidth-4        	  402494	       273.7 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_TUI_Prompt_Uniseg-4             	  267544	       387.3 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_TUI_Prompt_Uniseg-4             	  310561	       390.4 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_TUI_Prompt_Uniseg-4             	  258522	       386.9 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_TUI_TableHeader_Uniwidth-4      	  192607	       643.4 ns/op	     144 B/op	       1 allocs/op
BenchmarkStringWidth_TUI_TableHeader_Uniwidth-4      	  201369	       591.2 ns/op	     144 B/op	       1 allocs/op
BenchmarkStringWidth_TUI_TableHeader_Uniwidth-4      	  181639	       589.6 ns/op	     144 B/op	       1 allocs/op
BenchmarkStringWidth_TUI_TableHeader_GoRunewidth-4   	  172408	       674.8 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_TUI_TableHeader_GoRunewidth-4   	  176619	       693.0 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_TUI_TableHeader_GoRunewidth-4   	  161742	       682.2 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_TUI_TableHeader_Uniseg-4        	  127332	       947.1 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_TUI_TableHeader_Uniseg-4        	  127492	       942.8 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_TUI_TableHeader_Uniseg-4        	  123931	       947.0 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_TUI_StatusLine_Uniwidth-4       	  186957	       636.1 ns/op	     224 B/op	       1 allocs/op
BenchmarkStringWidth_TUI_StatusLine_Uniwidth-4       	  180982	       624.4 ns/op	     224 B/op	       1 allocs/op
BenchmarkStringWidth_TUI_StatusLine_Uniwidth-4       	  175650	       622.3 ns/op	     224 B/op	       1 allocs/op
BenchmarkStringWidth_TUI_StatusLine_GoRunewidth-4    	  124516	       943.6 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_TUI_StatusLine_GoRunewidth-4    	  129997	       942.0 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_TUI_StatusLine_GoRunewidth-4    	  128758	       939.3 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_TUI_StatusLine_Uniseg-4         	   87843	      1323 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_TUI_StatusLine_Uniseg-4         	   90361	      1317 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_TUI_StatusLine_Uniseg-4         	   91279	      1327 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Flags_Uniwidth-4                	 1071036	       111.8 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Flags_Uniwidth-4                	 1000000	       112.9 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Flags_Uniwidth-4                	 1070696	       112.0 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Flags_GoRunewidth-4             	  510364	       237.4 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Flags_GoRunewidth-4             	  502700	       236.5 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Flags_GoRunewidth-4             	  510729	       236.1 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Flags_Uniseg-4                  	  371520	       311.2 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Flags_Uniseg-4                  	  349556	       310.8 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Flags_Uniseg-4                  	  383445	       312.1 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ZWJ_Uniwidth-4                  	  629248	       197.6 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ZWJ_Uniwidth-4                  	  633081	       191.5 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ZWJ_Uniwidth-4                  	  628711	       190.5 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ZWJ_GoRunewidth-4               	  534358	       219.1 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ZWJ_GoRunewidth-4               	  547898	       219.9 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ZWJ_GoRunewidth-4               	  545785	       222.6 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ZWJ_Uniseg-4                    	  248534	       484.6 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ZWJ_Uniseg-4                    	  248049	       487.6 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_ZWJ_Uniseg-4                    	  217256	       488.4 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Combined_Uniwidth-4             	  377334	       290.5 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Combined_Uniwidth-4             	  415633	       292.3 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Combined_Uniwidth-4             	  356175	       290.9 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Combined_GoRunewidth-4          	  294151	       404.7 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Combined_GoRunewidth-4          	  296148	       404.8 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Combined_GoRunewidth-4          	  297165	       405.0 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Combined_Uniseg-4               	  160456	       708.1 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Combined_Uniseg-4               	  153279	       708.7 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringWidth_Combined_Uniseg-4               	  153867	       709.0 ns/op	       0 B/op	       0 allocs/op
PASS
ok  	github.com/unilibs/uniwidth/bench	22.511s

CI runners have ~10-20% variance. For accurate results, run locally: cd bench && go test -bench=. -benchmem -count=10

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 3, 2026

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 3, 2026

Regression Detection

Comparing main → PR #4

Summary: geomean 36.43n 36.50n +0.19%

⚠️ Potential regressions detected:

geomean                                36.43n          36.50n        +0.19%
geomean                                           ³                +0.00%               ³
geomean                                           ³                +0.00%               ³
Full benchstat output
goos: linux
goarch: amd64
pkg: github.com/unilibs/uniwidth
cpu: AMD EPYC 7763 64-Core Processor                
                                   │ base-bench.txt │            pr-bench.txt             │
                                   │     sec/op     │    sec/op      vs base              │
RuneWidth_ASCII-4                      2.182n ± ∞ ¹    2.181n ± ∞ ¹       ~ (p=0.571 n=5)
RuneWidth_CJK-4                        2.495n ± ∞ ¹    2.491n ± ∞ ¹       ~ (p=0.286 n=5)
RuneWidth_Emoji-4                      2.808n ± ∞ ¹    2.802n ± ∞ ¹       ~ (p=0.119 n=5)
StringWidth_ASCII_Short-4              5.943n ± ∞ ¹    5.978n ± ∞ ¹       ~ (p=0.143 n=5)
StringWidth_ASCII_Medium-4             16.83n ± ∞ ¹    16.82n ± ∞ ¹       ~ (p=0.452 n=5)
StringWidth_ASCII_Long-4               62.67n ± ∞ ¹    63.37n ± ∞ ¹       ~ (p=0.056 n=5)
StringWidth_CJK_Short-4                71.51n ± ∞ ¹    71.56n ± ∞ ¹       ~ (p=0.841 n=5)
StringWidth_CJK_Medium-4               726.7n ± ∞ ¹    716.1n ± ∞ ¹       ~ (p=0.151 n=5)
StringWidth_Mixed_Short-4              149.5n ± ∞ ¹    149.7n ± ∞ ¹       ~ (p=0.460 n=5)
StringWidth_Mixed_Medium-4             509.3n ± ∞ ¹    511.6n ± ∞ ¹       ~ (p=0.310 n=5)
StringWidth_Emoji_Short-4              153.3n ± ∞ ¹    152.8n ± ∞ ¹       ~ (p=0.056 n=5)
StringWidth_Emoji_Medium-4             633.0n ± ∞ ¹    635.0n ± ∞ ¹       ~ (p=0.310 n=5)
StringWidth_ZWJ_Family-4               84.83n ± ∞ ¹    84.80n ± ∞ ¹       ~ (p=0.373 n=5)
StringWidth_ZWJ_CoupleHeart-4          72.65n ± ∞ ¹    72.75n ± ∞ ¹       ~ (p=0.738 n=5)
StringWidth_EmojiModifier-4            33.15n ± ∞ ¹    33.16n ± ∞ ¹       ~ (p=0.595 n=5)
StringWidth_ZWJ_Mixed-4                298.1n ± ∞ ¹    298.6n ± ∞ ¹       ~ (p=0.595 n=5)
IsASCIIOnly_Short_ASCII-4              2.596n ± ∞ ¹    2.600n ± ∞ ¹       ~ (p=0.548 n=5)
IsASCIIOnly_Medium_ASCII-4             6.590n ± ∞ ¹    6.606n ± ∞ ¹       ~ (p=0.690 n=5)
IsASCIIOnly_Long_ASCII-4               24.32n ± ∞ ¹    24.37n ± ∞ ¹       ~ (p=0.841 n=5)
IsASCIIOnly_Short_NonASCII-4          0.9348n ± ∞ ¹   0.9358n ± ∞ ¹       ~ (p=0.841 n=5)
StringWidth_TUI_Prompt-4               158.5n ± ∞ ¹    158.3n ± ∞ ¹       ~ (p=0.889 n=5)
StringWidth_TUI_TableHeader-4          561.7n ± ∞ ¹    562.4n ± ∞ ¹       ~ (p=0.548 n=5)
StringWidth_TUI_StatusLine-4           566.4n ± ∞ ¹    572.4n ± ∞ ¹       ~ (p=0.056 n=5)
Conformance/AllCategories-4            44.27n ± ∞ ¹    44.56n ± ∞ ¹       ~ (p=0.079 n=5)
Conformance/CombiningMarks-4           14.68n ± ∞ ¹    14.66n ± ∞ ¹       ~ (p=0.063 n=5)
Conformance/ControlChars-4             2.493n ± ∞ ¹    2.495n ± ∞ ¹       ~ (p=0.095 n=5)
RuneWidthWithOptions/ASCII-4           22.71n ± ∞ ¹    22.83n ± ∞ ¹       ~ (p=0.690 n=5)
RuneWidthWithOptions/Ambiguous-4       26.34n ± ∞ ¹    26.32n ± ∞ ¹       ~ (p=0.635 n=5)
RuneWidthWithOptions/CJK-4             22.44n ± ∞ ¹    22.58n ± ∞ ¹       ~ (p=0.548 n=5)
StringWidthWithOptions/ASCII-4         25.05n ± ∞ ¹    25.19n ± ∞ ¹       ~ (p=0.690 n=5)
StringWidthWithOptions/Ambiguous-4     55.30n ± ∞ ¹    55.48n ± ∞ ¹       ~ (p=0.452 n=5)
StringWidthWithOptions/Mixed-4         70.16n ± ∞ ¹    70.89n ± ∞ ¹       ~ (p=0.151 n=5)
geomean                                36.43n          36.50n        +0.19%
¹ need >= 6 samples for confidence interval at level 0.95

                                   │ base-bench.txt │            pr-bench.txt             │
                                   │      B/op      │    B/op      vs base                │
RuneWidth_ASCII-4                       0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
RuneWidth_CJK-4                         0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
RuneWidth_Emoji-4                       0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_ASCII_Short-4               0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_ASCII_Medium-4              0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_ASCII_Long-4                0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_CJK_Short-4                 0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_CJK_Medium-4                144.0 ± ∞ ¹   144.0 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_Mixed_Short-4               0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_Mixed_Medium-4              192.0 ± ∞ ¹   192.0 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_Emoji_Short-4               0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_Emoji_Medium-4              240.0 ± ∞ ¹   240.0 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_ZWJ_Family-4                0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_ZWJ_CoupleHeart-4           0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_EmojiModifier-4             0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_ZWJ_Mixed-4                 0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
IsASCIIOnly_Short_ASCII-4               0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
IsASCIIOnly_Medium_ASCII-4              0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
IsASCIIOnly_Long_ASCII-4                0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
IsASCIIOnly_Short_NonASCII-4            0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_TUI_Prompt-4                0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_TUI_TableHeader-4           144.0 ± ∞ ¹   144.0 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_TUI_StatusLine-4            224.0 ± ∞ ¹   224.0 ± ∞ ¹       ~ (p=1.000 n=5) ²
Conformance/AllCategories-4             0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
Conformance/CombiningMarks-4            0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
Conformance/ControlChars-4              0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
RuneWidthWithOptions/ASCII-4            16.00 ± ∞ ¹   16.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
RuneWidthWithOptions/Ambiguous-4        16.00 ± ∞ ¹   16.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
RuneWidthWithOptions/CJK-4              16.00 ± ∞ ¹   16.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidthWithOptions/ASCII-4          16.00 ± ∞ ¹   16.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidthWithOptions/Ambiguous-4      16.00 ± ∞ ¹   16.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidthWithOptions/Mixed-4          16.00 ± ∞ ¹   16.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
geomean                                           ³                +0.00%               ³
¹ need >= 6 samples for confidence interval at level 0.95
² all samples are equal
³ summaries must be >0 to compute geomean

                                   │ base-bench.txt │            pr-bench.txt             │
                                   │   allocs/op    │  allocs/op   vs base                │
RuneWidth_ASCII-4                       0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
RuneWidth_CJK-4                         0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
RuneWidth_Emoji-4                       0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_ASCII_Short-4               0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_ASCII_Medium-4              0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_ASCII_Long-4                0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_CJK_Short-4                 0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_CJK_Medium-4                1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_Mixed_Short-4               0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_Mixed_Medium-4              1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_Emoji_Short-4               0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_Emoji_Medium-4              1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_ZWJ_Family-4                0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_ZWJ_CoupleHeart-4           0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_EmojiModifier-4             0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_ZWJ_Mixed-4                 0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
IsASCIIOnly_Short_ASCII-4               0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
IsASCIIOnly_Medium_ASCII-4              0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
IsASCIIOnly_Long_ASCII-4                0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
IsASCIIOnly_Short_NonASCII-4            0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_TUI_Prompt-4                0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_TUI_TableHeader-4           1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidth_TUI_StatusLine-4            1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
Conformance/AllCategories-4             0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
Conformance/CombiningMarks-4            0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
Conformance/ControlChars-4              0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
RuneWidthWithOptions/ASCII-4            1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
RuneWidthWithOptions/Ambiguous-4        1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
RuneWidthWithOptions/CJK-4              1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidthWithOptions/ASCII-4          1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidthWithOptions/Ambiguous-4      1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StringWidthWithOptions/Mixed-4          1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
geomean                                           ³                +0.00%               ³
¹ need >= 6 samples for confidence interval at level 0.95
² all samples are equal
³ summaries must be >0 to compute geomean

kolkov added 2 commits March 3, 2026 20:13
rune is int32; valid Unicode codepoints (0–0x10FFFF) are always
non-negative, so uint32 conversion cannot overflow.
@kolkov kolkov merged commit 899895c into main Mar 3, 2026
10 checks passed
@kolkov kolkov deleted the test/coverage-100 branch March 3, 2026 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant