facebookresearch / pytorch3d
Unit Size

The distribution of size of units (measured in lines of code).

Intro
  • Unit size measurements show the distribution of size of units of code (methods, functions...).
  • Units are classified in four categories based on their size (lines of code): 1-20 (small units), 20-50 (medium size units), 51-100 (long units), 101+ (very long units).
  • You should aim at keeping units small (< 20 lines). Long units may become "bloaters", code that have increased to such gargantuan proportions that they are hard to work with.
Learn more...
Unit Size Overall
  • There are 1,028 units with 14,612 lines of code in units (39.9% of code).
    • 16 very long units (3,366 lines of code)
    • 29 long units (1,814 lines of code)
    • 112 medium size units (3,388 lines of code)
    • 186 small units (2,776 lines of code)
    • 685 very small units (3,268 lines of code)
23% | 12% | 23% | 18% | 22%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
h50% | 5% | 18% | 19% | 7%
cpp36% | 23% | 31% | 2% | 6%
py4% | 10% | 23% | 24% | 36%
js0% | 77% | 0% | 17% | 5%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
pytorch3d/csrc44% | 12% | 23% | 12% | 6%
projects/nerf35% | 0% | 10% | 7% | 47%
pytorch3d/ops11% | 5% | 12% | 31% | 39%
pytorch3d/renderer4% | 7% | 25% | 26% | 36%
pytorch3d/structures0% | 19% | 31% | 25% | 24%
pytorch3d/io0% | 17% | 26% | 17% | 38%
website/pages0% | 100% | 0% | 0% | 0%
pytorch3d/datasets0% | 23% | 17% | 41% | 17%
ROOT0% | 84% | 0% | 0% | 15%
website/core0% | 53% | 0% | 35% | 10%
pytorch3d/loss0% | 0% | 62% | 7% | 29%
pytorch3d/transforms0% | 0% | 18% | 33% | 48%
scripts0% | 0% | 100% | 0% | 0%
pytorch3d/vis0% | 0% | 0% | 36% | 63%
pytorch3d/utils0% | 0% | 0% | 41% | 58%
pytorch3d/common0% | 0% | 0% | 17% | 82%
packaging/linux_wheels0% | 0% | 0% | 42% | 57%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
INLINE DEVICE bool draw()
in pytorch3d/csrc/pulsar/include/renderer.draw.device.h
712 55 30
std::tuple Renderer::arg_check()
in pytorch3d/csrc/pulsar/pytorch/renderer.cpp
441 37 17
GLOBAL void render()
in pytorch3d/csrc/pulsar/include/renderer.render.device.h
317 45 19
void forward()
in pytorch3d/csrc/pulsar/include/renderer.forward.device.h
269 16 13
std::tuple Renderer::forward()
in pytorch3d/csrc/pulsar/pytorch/renderer.cpp
220 16 17
def main()
in projects/nerf/train_nerf.py
172 29 1
void backward()
in pytorch3d/csrc/pulsar/include/renderer.backward.device.h
163 8 20
GLOBAL void calc_gradients()
in pytorch3d/csrc/pulsar/include/renderer.calc_gradients.device.h
149 9 26
GLOBAL void calc_signature()
in pytorch3d/csrc/pulsar/include/renderer.calc_signature.device.h
147 12 5
void backward_dbg()
in pytorch3d/csrc/pulsar/include/renderer.backward_dbg.device.h
130 8 22
at::Tensor FaceAreasNormalsBackwardCpu()
in pytorch3d/csrc/face_areas_normals/face_areas_normals_cpu.cpp
118 3 4
def cubify()
in pytorch3d/ops/cubify.py
112 10 4
INLINE DEVICE bool get_screen_area()
in pytorch3d/csrc/pulsar/include/renderer.get_screen_area.device.h
105 3 9
void PointsToVolumesBackwardCpu()
in pytorch3d/csrc/points_to_volumes/points_to_volumes_cpu.cpp
104 22 11
torch::Tensor RasterizeMeshesBackwardCpu()
in pytorch3d/csrc/rasterize_meshes/rasterize_meshes_cpu.cpp
104 13 7
def backward()
in pytorch3d/renderer/points/pulsar/renderer.py
103 15 3
def __getitem__()
in pytorch3d/datasets/r2n2/r2n2.py
87 19 3
HOST void construct()
in pytorch3d/csrc/pulsar/include/renderer.construct.device.h
85 4 9
def forward()
in pytorch3d/renderer/points/pulsar/unified.py
84 8 3
void PointsToVolumesForwardCpu()
in pytorch3d/csrc/points_to_volumes/points_to_volumes_cpu.cpp
78 17 9