1. A computerized apparatus for determining an access relation between fields of a structure in a computer program, the computerized apparatus having a processor, the computerized apparatus comprising: a trace obtainer implemented by a processor and instructions thereto, and configured to obtain a trace associated with an execution of the computer program, the trace comprising at least one indication of access to a portion of the fields of the structure; an instance identification module implemented by a processor and instructions thereto, and configured to identify an instance of the structure accessed during the at least one indication of access; an access relation determination module implemented by a processor and instructions thereto, and configured to determine the access relation between at least two fields of the fields of the structure, wherein said the access relation determination module is configured to determine the access relation based on indications of accesses to the at least two fields in the instance of the structure, determine an order in which the at least two fields be being accessed based on the trace, update a Close Proximity Graph (CPG) based on the order, wherein the CPG having nodes representing the fields of the instance of the structure and having edges representing the access relation between the at least two fields of the instance of the structure; and a proximate access module configured to determine whether the accesses to the at least two fields in the instance of the structure are performed within a predetermine number of accesses; an optimization module configured to determine a data layout of the fields of the structure based on the access relation determined by said access relation determination module, the optimization module comprises a field grouper implemented by a processor and instructions thereto, and configured to determine groups of related fields based on the access relation determined by said access relation determination module, and partitioning the CPG into strongly connected components (SCCS); and a compiler compiling the program and utilizing the SCCS in the data layout.