SeasideSt / Seaside

The framework for developing sophisticated web applications in Smalltalk.
MIT License
519 stars 71 forks source link

WAUrl >> #postCopy copies nil #1330

Closed marschall closed 2 years ago

marschall commented 2 years ago

In a recent profiling UndefinedObject(Object)>>copy showed up, the culprit was WAUrl >> #postCopy

15.6% {14ms} AJPResponseBuffer>>incrementPacketIndex
12.2% {11ms} GRPharoZnCodecStream>>nextPut:
6.7% {6ms} WAPharoUrlEncoder(WAPharoEncoder)>>nextPut:
5.6% {5ms} WAAnchorTag(WATagBrush)>>with:
5.6% {5ms} WARequestFields(GRSmallDictionary2)>>keysAndValuesDo:
5.6% {5ms} GRPharoZnCodecStream>>nextPutAll:
5.6% {5ms} Character class>>codePoint:
5.6% {5ms} WAHtmlDocument(WADocument)>>nextPutAll:
4.4% {4ms} ZnUTF8Encoder>>next:putAllASCII:startingAt:toStream:
3.3% {3ms} AJPResponseBuffer>>nextPut:
3.3% {3ms} ByteString class(Object)>>hash
2.2% {2ms} WAHtmlCanvas(WACanvas)>>flush
2.2% {2ms} OrderedCollection>>postCopy
2.2% {2ms} WAHtmlAttributes(GRSmallDictionary)>>findIndexFor:
2.2% {2ms} AJPResponseBuffer>>ensureCapacity:
2.2% {2ms} AJPResponseBuffer>>prepareWrite:
2.2% {2ms} WAAnchorTag>>name:
2.2% {2ms} WAHtmlAttributes(GRSmallDictionary)>>at:put:
2.2% {2ms} ZnUTF8Encoder>>nextPutCodePoint:toStream:
2.2% {2ms} Array(SequenceableCollection)>>do:
2.2% {2ms} UndefinedObject(Object)>>copy
2.2% {2ms} ByteString(String)>>=
2.2% {2ms} AJPResponseBuffer>>finishPacketIfAtEnd
jbrichau commented 2 years ago

Wondering: is this an issue somewhere. In other words: isn't the following true? nil copy == nil

marschall commented 2 years ago

Wondering: is this an issue somewhere. In other words: isn't the following true? nil copy == nil

Yes, it's true. It goes through Object >> #copy which goes through UndefinedObject >> #shallowCopy which returns self and then goes through Object >> #postCopy.

I guess I could file a bug against Pharo as well.

jbrichau commented 2 years ago

Trying to understand the issue here... You mean UndefinedObject>>copy should be defined returning nil ?

marschall commented 2 years ago

Trying to understand the issue here...

We send #copy to nil. This sometimes shows up during profiling.

You mean UndefinedObject>>copy should be defined returning nil ?

Probably.