Reducing Program Size with the MPU-6050

While developing code for my project, I started realizing that I am running out of space. I started commenting out random lines of code to see how much size they take up and I found out that devStatus = mpu.dmpInitialize(); takes up 21% alone of my program space!

I want to reduce that, so I found the function in the MPU6050_6Axis_MotionApps20.h library which I have attached below. My question is what exactly in the uint8_t MPU6050::dmpInitialize() function is taking up so much space? Is it possible to reduce the program size of this function?

My project uses an MPU-6050 gyroscope and accelerometer hooked up to an Arduino Micro.

MPU6050_6Axis_MotionApps20.h (40.3 KB)

Which MPU6050 library are you using?

takes up 21%

It looks like most of the MPU6050 libraries include something like 2.5k of binary code and parameters for the MPU device, but that should only be about 10% of program memory space of a ATmega328...

I am using the library by I2CDev, and I am also using an Atmel32u4, which has a slightly larger bootloader size than the 328. But when I compile the code, with and without that line, I get a difference in program size of 6064 bytes. That seems like a lot!

mschindl:
I am using the library by I2CDev

This one? https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/MPU6050

Would it have been so hard to post a link? When you're asking for help it's a good idea to make it as easy as possible for the people offering free assistance.