Comments (4)
Try to use copy-by-reference option not to create a separate array. As far as I know we do use System.arrayCopy in some places. If you could profile and see where it is missing would be great.
from dozer.
Please, could you provide a code of concrete test case? Maybe, I will research it in the nearest future and try to fix.
BTW, feel free to submit patch :)
from dozer.
Hello, test case below.
In the head version of Dozer, the time is spent in MappingProcessor.addToPrimitiveArray .
It is much easier to fix than in previous release.
btw, my initial post was wrong concerning the immutables types. Maybe System.arrayCopy could also be used for types that are both "copy-by-reference" and final.
It could be useful for String[]
The following TC outputs ~1000 (ms) on my machine
public class DozerPerformanceTest extends TestCase {
public static class ByteTest {
private byte[] data;
public byte[] getData() {
return data;
}
public void setData(byte[] data) {
this.data = data;
}
}
public void testByteCopy() {
RootLogger.getRootLogger().setLevel(Level.WARN);
ByteTest test = new ByteTest();
test.setData(new byte[1024 * 1024]);
DozerBeanMapper dozer = new DozerBeanMapper();
ByteTest map = dozer.map(test, ByteTest.class);
long start = System.currentTimeMillis();
map = dozer.map(test, ByteTest.class);
System.out.println(System.currentTimeMillis() - start);
}
}
from dozer.
This part of the code handles mixed element collections, but your final + copy-by-reference is a perfect solution how to distinguish the need for System.arrayCopy()!
So the solution should be - if it is a typed collection and type is final and copy-by-referenced, then do native array copy.
from dozer.
Related Issues (20)
- protobuf3 enum map error HOT 2
- add chain methods invoke features,maybe a good idea
- Trying to map String (dd-MMM-yyyy HH:mm:ss) -> java.sql.Timestamp but mapper exceptions HOT 1
- High CPU in combination with openjdk11 and log4j2 HOT 2
- Deploy 6.5.1 on maven HOT 2
- CVE-2021-29425 in commons-io HOT 1
- MappedFieldsTracker throws Exceptions HOT 2
- Mapping of 2D string array seems to be skipped silently
- Keeping source and target POJO outside the classpath HOT 3
- Cannot convert from java.time.Instant to java.utli.Date anymore HOT 1
- what's relationship with 'dozer' and 'dozer-core' of dependency HOT 1
- CustomConverter not able to be set by withCustomConverter within DozerBeanMapperBuilder HOT 5
- java.util.HashSet cannot be cast to java.util.List HOT 2
- Why is Dozer is not calling my custom converter for a class
- dozer can not work for springboot 3 HOT 7
- Dozer to Mapstruct Intellij plugin. HOT 1
- copy Map<String,Object> cause recursive value HOT 1
- Not able to start the Server(Wildfly 18 ) while updating the Dozer-Core 6.5.2 jars HOT 1
- List of Critical vulnerabilities in the package dependencies HOT 3
- Dozer 6.5.2 not compatible with Java17 and Jakarta HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dozer.