<div dir="ltr">Hi wenshao, I think this proposed minor cleanup is reasonable.<div>Looking at the overall context, I think that piece of code needs a more general rewrite to ensure better performance.</div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Sat, Sep 27, 2025 at 7:24 PM wenshao <<a href="mailto:shaojin.wensj@alibaba-inc.com">shaojin.wensj@alibaba-inc.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div style="font-family:Tahoma,Arial,STHeitiSC-Light,SimSun"><div style="clear:both"><span>The DateTimeFormatterBuilder::FIELD_MAP is of type Map<Character, TemporalField>, with key values in the range 'A-Z' and 'a-z'.</span></div><div style="clear:both"><br><div style="clear:both">We can change the type of FIELD_MAP to an array of length 128 and then use char as an index to access the array.</div><div style="clear:both"><br></div><div style="clear:both">This will reduce the memory usage of DateTimeFormatterBuilder::FIELD_MAP and improve performance slightly.</div><div style="clear:both"><br></div><span>By analyzing the jmap dump memory, we can see that the memory size used by DateTimeFormatterBuilder::FIELD_MAP has dropped from 1.12kb to 528b, the number of objects has decreased and the memory has become more flat. as shown below:</span></div><div style="clear:both"><span><br></span></div><div style="clear:both"><span>before:</span></div><div style="clear:both"><span><img alt="image" src="https://private-user-images.githubusercontent.com/1166785/474884443-57d4c513-55c7-472e-95a8-9f7a4b47662d.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NTkwMTgxNjgsIm5iZiI6MTc1OTAxNzg2OCwicGF0aCI6Ii8xMTY2Nzg1LzQ3NDg4NDQ0My01N2Q0YzUxMy01NWM3LTQ3MmUtOTVhOC05ZjdhNGI0NzY2MmQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDkyOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTA5MjhUMDAwNDI4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZjRiMzI1NDBjZjlkYmQ5ZDkyMTkxYmMyMWRhY2FiODc5YTcxMDExMDE0OGM2MTQzZWM1Yjk4MTU1MWU3MDAzZCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.o2NU-RDNpFHMFSUsROauvlN-JrKaJb_VYuImQP6Lf4Y" style="vertical-align: bottom;"></span></div><div style="clear:both"><span><br></span></div><div style="clear:both"><span>after:</span></div><div style="clear:both"><span><img alt="image" src="https://private-user-images.githubusercontent.com/1166785/474881775-89cbfb6c-360a-475f-85ea-4365d3b66871.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NTkwMTgxNjgsIm5iZiI6MTc1OTAxNzg2OCwicGF0aCI6Ii8xMTY2Nzg1LzQ3NDg4MTc3NS04OWNiZmI2Yy0zNjBhLTQ3NWYtODVlYS00MzY1ZDNiNjY4NzEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDkyOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTA5MjhUMDAwNDI4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MDA4ZTcwMGI2ZWMzYzRlZjMyMmYwNTI2MzM2MTllYzIyNjY4NTUwYzI3NDJlZTFhYzAwYWZkMDMxOGMyYzFhYyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.KAj3dkBM4tJbX98gfPipjtOlUAL7yY2WWYgiRKURASU" style="vertical-align: bottom;"></span></div><div style="clear:both"><span><br></span></div><div style="clear:both"><span><br></span></div><div style="clear:both"><span><span>In order to make it easier for reviewers to see my ideas, I submitted a draft Pull Request ( <a href="https://github.com/openjdk/jdk/pull/26634" target="_blank">https://github.com/openjdk/jdk/pull/26634</a> ). Please give me feedback.</span></span></div><div style="clear:both"><span><span><br></span></span></div></div></div></blockquote></div>