| Weld version is 2.4.1.Final The reason of starting investigation on it, is the impact in an real world application, but it is also measurable with a small unit test. Bean discovery mode is ALL.
| WeldTest.java |
package weld.tests; |
|
import org.jboss.weld.environment.se.Weld; |
import org.jboss.weld.environment.se.WeldContainer; |
import org.jboss.weld.manager.api.WeldManager; |
import org.junit.Test; |
|
import com.google.common.base.Stopwatch; |
|
public class WeldTest { |
|
@Test |
public void test() { |
for (int i = 0; i < 10; i++) { |
run(); |
} |
} |
|
private void run() { |
try (final WeldContainer container = new Weld().initialize()) { |
final WeldManager beanManager = (WeldManager) container.getBeanManager(); |
final Stopwatch stopwatch = Stopwatch.createStarted(); |
for (int i = 0; i < 1000; i++) { |
beanManager.instance(); |
} |
System.out.println(container.getId() + " " + stopwatch); |
} |
} |
}
|
Results: With weld 2.4.1 eb85bab1-a797-425f-9dba-b22072d0248f 5.667 ms 64bee1c8-d991-4e73-a783-278792a9fcc6 1.867 ms ad657714-e8ed-4618-979c-b15a7b328f52 1.414 ms 5f53def6-935f-4ec9-8816-cf4498bab9d3 1.488 ms 70bd2f45-e4f5-4af7-80c2-ba2a98d184d8 2.161 ms 9114aff3-2d1a-45b3-b43d-a79eb961f661 1.179 ms a7b3050f-2819-40fa-8146-31cbce6a8cdf 1.264 ms e5fd92db-d493-4ad3-9d36-11ba32b84074 1.850 ms a83cb6a3-9532-47ef-9d8d-deaf9a50e528 1.132 ms 63ec5229-2b03-4977-b233-661825bf5b2b 968.1 μs With Weld 3.0.0 CR e458fa23-e7db-45ff-8f9e-5855825b5b1a 353.8 ms a69cf54f-12f5-47da-8873-adff1eee8513 487.2 ms a98efa6d-bf2d-4d81-baa8-49e373d8009f 427.3 ms f83ed503-3452-4a4f-b93e-4bc234fbe981 345.1 ms 7b854320-b66d-48ba-9e2a-59389e16ccf4 371.9 ms fca178ca-50a9-41fb-9e31-5d740fb52677 342.6 ms 47c40545-806f-420e-b77d-98262bdf9355 456.4 ms 1242463b-33f8-48e9-bcc2-7dce44034bfd 328.4 ms 0951b69b-0fcd-4ebe-af29-d41dacaffbf0 337.8 ms ca1a806a-24cf-4b18-8517-35cc169c6bfc 334.2 ms |